63
\$\begingroup\$

I am interested in seeing programs which don't ask for any input, print a googol copies of some nonempty string, no less, no more, and then stop. A googol is defined as 10^100, i.e., 1 followed by a hundred 0's in decimal.

Example output:

111111111111111111111111111111111111111111111111111111111111111111111111...

or

Hello world
Hello world
Hello world
Hello world
Hello world
Hello world
...

The string can also be entirely composed of white space or special symbols. The only exception to identical copies of a fixed string is if your language decorates the output in some way that can not be prevented, but could be trivially undone in a wrapper script, like prepending a line number to each line. The wrapper script in such cases need not be provided.

You can assume your computer will never run out of time, but other than that, your program must have a reasonable demand of resources. Also, you must respect any restrictions that the programming language of your choice poses, for example, you can not exceed a maximum value allowed for its integer types, and at no point more than 4 GB of memory must be needed.

In other words, the program should in principle be testable by running it on your computer. But because of the extent of this number you will be expected to prove that the number of copies of the string it outputs is exactly 10^100 and that the program stops afterwards. Stopping can be exiting or halting or even terminating due to an error, but if so, the error must not produce any output that could not easily be separated from the program's output.

This is , so the solution with the fewest bytes wins.

Example solution (C, ungolfed, 3768 bytes)

#include <stdio.h>

int main() {
  int a00, a01, a02, a03, ..., a99;
  for(a00 = 0; a00 < 10; a00++)
  for(a01 = 0; a01 < 10; a01++)
  for(a02 = 0; a02 < 10; a02++)
  for(a03 = 0; a03 < 10; a03++)
  ...
  for(a99 = 0; a99 < 10; a99++)
    puts("1");
  return 0;
}
\$\endgroup\$
  • 10
    \$\begingroup\$ Consider the sandbox first next time. \$\endgroup\$ – cat Oct 29 '16 at 18:44
  • 9
    \$\begingroup\$ When you post a new question, you are asked to first post it in the sandbox. \$\endgroup\$ – flawr Oct 29 '16 at 18:48
  • 1
    \$\begingroup\$ @KritixiLithos It was toying with that idea but I could not quickly come up with a sample solution. Feel free to make a sequel :-) \$\endgroup\$ – The Vee Oct 29 '16 at 19:16
  • 3
    \$\begingroup\$ @closevoter Are you sure this is too broad? Common sense automatically narrows this down from "print a nonempty string 10^100 times" to "print a character 10^100 times". \$\endgroup\$ – dorukayhan Oct 29 '16 at 23:47
  • 3
    \$\begingroup\$ TIL Googol-1 in Roman numerals \$\endgroup\$ – mbomb007 Oct 31 '16 at 18:36

58 Answers 58

2
\$\begingroup\$

C# - 127 123 98 bytes

using System;using b=Numerics.BigInteger;void f(){for(b n=b.Pow(10,100);n-->0;)Console.Write(0);}}

Prints 10^100 copies of 0.

\$\endgroup\$
  • \$\begingroup\$ You can golf it by 1 byte by changing n>0;n-- to n-->0;. +1 for the rest. :) \$\endgroup\$ – Kevin Cruijssen Oct 31 '16 at 14:53
  • \$\begingroup\$ @KevinCruijssen I can also save bytes by turning this into a shorter function, since OP didn't mention "full program". Thanks! :) \$\endgroup\$ – Yytsi Oct 31 '16 at 17:07
  • \$\begingroup\$ Also you can change your using to using b= System.Numerics.BigInteger and use the alias in the rest of the code \$\endgroup\$ – Phaeze Nov 3 '16 at 22:13
  • \$\begingroup\$ This should work using System;using b=Numerics.BigInteger;void f(){for(b n=b.Pow(10,100);n-->0;)Console.Write(0);}} for 98 bytes. :) \$\endgroup\$ – Phaeze Nov 3 '16 at 22:23
  • \$\begingroup\$ @Phaeze Thanks! Haven't even edited the previous edit in yet, but will do today :) \$\endgroup\$ – Yytsi Nov 4 '16 at 4:46
2
\$\begingroup\$

PHP, 39 38 bytes

for($a=str_pad(e,99,0);T^$a++;)echo!0;

Run like this:

php -r 'for($a=str_pad(e,99,0);T^$a++;)echo!0;' 2>/dev/null

STDERR (34 bytes)

If a variant with output to STDERR is valid, then this outputs PHP Notice: Use of undefined constant T - assumed 'T' in Command line code on line 1 a googol times.

php -r 'for($a=str_pad(@e,99,0);T^++$a;);'

Explanation

for (
    $a = str_pad("e", 99, "0"); // Creates a string "e000" (98 zeroes).
    "T" ^ $a++;                 // Increment the string, binary XOR with
                                // "T": when the alphabetic part of the 
                                // string becomes "da" this results in 
                                // falsy "0", ending the loop.
)
    echo!0;                     // Print a single "1".

Note that the alphabetic part iterates from e..z (22), aa..az (26), ba..bz (26), ca..cz (26) for a total of 100, or a 1 with 2 zeroes. So only 98 zeroes need to be added to arrive at 1E100. The loop stops only when the alphabetic part is 2 digits and the second digit becomes d. The d is conveniently skipped when it's only 1 digit (since it starts at e).

Perf

This doesn't consume a ridiculous amount of resources (in fact very little) and runs fast.

Tweaks

  • Saved a byte by using 2 alphabetic chars so less padding characters (99 vs 101)
  • Added a variant using STDERR, saving 5 bytes
\$\endgroup\$
  • 1
    \$\begingroup\$ Your code must be within <?php tags, even if it is a pure .php file. However, in a PHP file, you can omit the closing ?> tag. Just saying. \$\endgroup\$ – ckjbgames Jan 23 '17 at 22:27
  • \$\begingroup\$ @ckjbgames wrong. Ever tried running code with php -r? In any case, here's the relevant discussion about that. \$\endgroup\$ – aross Jan 24 '17 at 8:49
  • \$\begingroup\$ You would need to if it was meant to be on a webpage. \$\endgroup\$ – ckjbgames Jan 24 '17 at 14:15
2
\$\begingroup\$

Brainfuck, 45 bytes

->-[[->+<]+>-]<[[>-<-[>[----->]]>[<]<].<[+]<]

It outputs 254×250255 null bytes and exits with an error.

Brainfuck, 50 48 bytes, without errors

>>>->-[[->+<]+>-]<[[>-<-[>[----->]]>[<]<]<[.+]<]

It outputs 254×250255 times \xfa\xfb\xfc\xfd\xfe\xff, and 1524×250255 bytes in total.

\$\endgroup\$
1
\$\begingroup\$

Python 2, 35 bytes

Under more realistic programming circumstances, Python allows you to multiply strings by a number, as with 'x' * 100, which would produce a string that's a hundred characters long and composed of nothing but the letter x.

However, it appears that Python string objects don't appreciate having indices whose values exceed the maximum of int. Python is content to re-cast large int values to a special bignum sort of thing, but the longest string that Python can handle is on the order of several gigabytes, and assuming each character in Python is 1 byte, it would take much, much more memory to contain the string that would unfold from 'x'*10**100.

As such, Python's built-in arbitrary arithmetic and the humble while loop allow us to produce a more practical program, which spits out one x per line for a googol lines. Thankfully, this proves to be shorter than the admittedly more readable for x in xrange(10**100):, as range() and xrange() are both limited to the largest possible value for a C long type, which is Python's native non-bignum int.

i=0
while i<10**100:
    print'x';i+=1
\$\endgroup\$
  • \$\begingroup\$ i=10**100 newline while i:print;i-=1 prints googol newlines and is 7 bytes shorter \$\endgroup\$ – FlipTack Oct 30 '16 at 11:03
  • \$\begingroup\$ It's also am exact copy of someone else's solution, so I'll leave it as is. \$\endgroup\$ – James Murphy Oct 30 '16 at 12:32
  • \$\begingroup\$ If I'm right, it's an exact copy of @FlipTack program. \$\endgroup\$ – user63571 Jan 23 '17 at 23:39
1
\$\begingroup\$

Common Lisp, 33

(dotimes(i(expt 10 100))(terpri))

Print newlines.

\$\endgroup\$
1
\$\begingroup\$

Swift 3, 55 bytes

Dependency: Foundation for pow(73 bytes if you count import statement)

stride(from:0,to:pow(10,100),by:1).map{_ in print(1)}

I know there is another answer above. However, pow(10,100.0) generates error message: fatal error: Double value cannot be converted to Int because the result would be greater than Int.max, and it also requires Foundation as well

\$\endgroup\$
  • 3
    \$\begingroup\$ Yes, necessary imports are always counted. \$\endgroup\$ – cat Oct 30 '16 at 21:08
1
\$\begingroup\$

Clojure, 36 bytes

(doseq[i(range(.pow 100M 50))](prn))

Using java interlop cuts it down from original (reduce *'(repeat 10 100)) since clojure core does not have exponent. dotimes can only work with longs as was pointed out in comment, sadly; I had to resort to lazy seq (+5 bytes).

\$\endgroup\$
  • \$\begingroup\$ dotimes requires long as a parameter doesn't it? \$\endgroup\$ – cliffroot Oct 31 '16 at 10:12
  • \$\begingroup\$ It works with any N that returns TRUE for (number? N), rounding or dropping fractions when needed. \$\endgroup\$ – Michael M Oct 31 '16 at 11:33
  • \$\begingroup\$ goo.gl/xjwj0e it casts it to long. it agrees with the results that I get when I try to run your code, it fails with IllegalArgumentException trying to cast that number to long \$\endgroup\$ – cliffroot Oct 31 '16 at 11:41
  • 1
    \$\begingroup\$ You are right, I had an overwritten core dotimes with some math package. I will edit with something that works in a moment. \$\endgroup\$ – Michael M Oct 31 '16 at 11:54
1
\$\begingroup\$

Common Lisp, 37 bytes

(loop repeat(expt 10 100)do(print'x))

Nothing fancy. Print X followed by newline 10^100 times.

\$\endgroup\$
1
\$\begingroup\$

LiveCode, 83 bytes

on g c
   if c=100 then
      put 1 after fld 1
   else
      repeat 10
         g c+1
      end repeat
   end if
end g

Logically pretty straightforward, but validated by changing the test value for c. Set it to 1, you get ten 1's. Set it to 2, you get 100. Set it to 3 you get 1,000, etc.

LiveCode automatically formats with leading spaces, but it's not required for the code to work.

The argument c will default to empty, and in LiveCode it's perfectly fine to add 1 to empty (and results in 1).

LiveCode can write to stdout, but it's a visual environment and putting text into a field is more common.

\$\endgroup\$
1
\$\begingroup\$

Sed + bash, 107 bytes

sed "s/Z/\;done/g;s/\([A-L]\)/\1=n\;while((\1--))\;do /g"<<<"n=10;An=10**9;BCDEFGHIJKLpwdZZZZZZZZZZZZ"|bash

By removing the "|bash" at the end, you can see that the bash script generated (with newlines added for readability) is

n=10;A=n;while((A--));do n=10**9;B=n;while((B--));do C=n;while((C--));do
D=n;while((D--));do E=n;while((E--));do F=n;while((F--));do G=n;while((G--));do
H=n;while((H--));do I=n;while((I--));do J=n;while((J--));do K=n;while((K--));do
L=n;while((L--));do pwd;done;done;done;done;done;done;done;done;done;done;done;
done

which is similar to my original bash solution, below, except that it runs 11 loops of 10^9 nested in one loop of 10, for a total of 10^100 iterations. It never uses a value greater than 10^9, which fits in 32 bits. Each output line is generated with the shell builtin "pwd" instead of "echo", to save a byte.

Tested by changing 10**9 to "2" or "3" and verifying that the script generates 10 * N^11 lines.

Bash, 312 bytes

n=2*10**9
a=9765625;while((a--));do
b=n;while((b--));do c=n;while((c--));do d=n;while((d--));do e=n;while((e--));do
f=n;while((f--));do g=n;while((g--));do h=n;while((h--));do i=n;while((i--));do
j=n;while((j--));do k=n;while((k--));do echo "Hello, World!"
done;done;done;done;done;done;done;done;done;done;done

(2*10^9)^10 * 9765725 is exactly one googol.

This needs no memory because it doesn't store anything other than the 11 counters and one copy of the "Hello, World!" string. The counters are integers that never exceed 32 bits.

Unfortunately I couldn't find a way to do this with a recursive function.

\$\endgroup\$
1
\$\begingroup\$

LOLCODE, 224 bytes

HAI 1.2
I HAS A n ITZ A NUMBR
n R 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
IM IN YR loop UPPIN YR v TIL BOTH SAEM v AN n
BTW THIS WHERE I PRINT
VISIBLE "HAI!!1"
IM OUTTA YR loop
KTHXBYE

I had absolutely no idea how to calculate 10100, so why not just write it out? Apparently, there's no ^ operator or power function in LOLCODE.

I didn't count the bytes for the BTW part, since it's a comment for explaining the code. "explain"

Also, my ressource didn't quite explain how datatypes work in-depth, so we can only assume that NUMBR can store this much.

\$\endgroup\$
  • \$\begingroup\$ Try I HAS A b ITZ A NUMBR b R 10 I HAS A n ITZ A NUMBR n R PRODUKT OF b AN PRODUKT OF b AN n instead of using n R 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000. \$\endgroup\$ – ckjbgames Jan 23 '17 at 22:23
1
\$\begingroup\$

Perl 6, 18 bytes

say 1 for ^10**100

Notes:

  • Perl 6 integers have no upper limit, so 10**100 calculates the googol just fine.
  • The ^n syntax is short for 0 ..^ n, which constructs a range from 0 (inclusive) to n (not inclusive), which conceptually contains n integers but is stored as a memory-efficient Range object.
  • The for loop iterates over it without keeping already iterated elements in memory, so the program's RAM usage will remain pretty stable - and far below 4 GB - throughout its runtime.
\$\endgroup\$
1
\$\begingroup\$

Pushy, 5 bytes

Non-competing as the language postdates the challenge.

THe:"

Prints 10100 newlines. You can Try it online, but output is truncated at 100KB, and the site becomes very unresponsive when you run it.

T      \ Push 10
 H     \ Push 100
  e    \ Exponentiate - pops both and computes 10 ^ 100
   :   \ Pop the googol and that many times do:
    "  \   Print the whole stack - just a newline, as it's now empty.

You can verify this generates a googol by running THe# in the online interpreter. The reference implementation is in Python and therefore has no upper limit on integer size. The googol itself does not take too much data to store, in fact you only need 333 bits to store an integer of that size (although as Python integer this seems to take up 58 bytes) - nowhere near the memory restriction on this challenge.

\$\endgroup\$
1
\$\begingroup\$

Actually, 9 bytes

2╤╤DW;Y.D

Try it online!

This takes a really long time to run. Here is a faster version that only prints 100 zeroes.

Explanation:

2╤╤DW;Y.D
2╤╤         push 10**(10**2)
   D        subtract 1
    W       while the value on top of the stack is truthy:
     ;Y.      duplicate it, boolean negate it (0 if truthy, 1 if falsey), pop it and print it
        D     decrement the other copy
            (after the while loop finished, (10**100)-1 zeroes will have been printed, separated by newlines)
            implicitly print the only stack value (0), followed by a newline
\$\endgroup\$
  • \$\begingroup\$ Does this fit within the memory requirements of the challenge? sys.getsizeof(1) returns 28, and so storing a googol copies of 1 would take 2.8 × 10^89 TB, but the challenge restricts memory to 4GB. I may be wrong though, I don't know how Actually is interpreted. \$\endgroup\$ – FlipTack Jan 23 '17 at 22:57
  • \$\begingroup\$ @FlipTack In Python (the language that Actually is written in), small integers (under 256, I believe) are not unique objects - there is only ever one 1. Thus, this program just contains a googol references to 1, which are much smaller than the actual object. I don't know the memory impact of multiple references to 1, though, so it may still violate the memory limit. I'll change it to something that definitely doesn't run afoul. \$\endgroup\$ – Mego Jan 23 '17 at 23:01
  • \$\begingroup\$ I don't think storing a googol of anything is possible, whether it be integers or references. Even just storing a googol bits needs 1.25 × 1087 terabytes. So the new solution seems more sensible. \$\endgroup\$ – FlipTack Jan 25 '17 at 21:03
  • \$\begingroup\$ I meant 1.25 x 10^87 (missed the exponent) \$\endgroup\$ – FlipTack Jan 26 '17 at 10:29
1
\$\begingroup\$

TrumpScript 189 bytes

I is 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A is,I -I;We is 1000001 -1000000as long as,I >A;:say,A;I is,I -We;!America is great

Try it online!

Unfortunately 100 bytes taken up by the number as TrumpScript has no exponentials

Explanation

I is googol (using googol for clarity) sets the variable I to 10^100

A is I -I sets A to 0. 0 in the code as a number is invalid as all number must be > 1000000

We is 1000001 -1000000 assigns we as 1

as long as, I > A;: starts while loop checking that I > 0

say A prints out 0

I is,I -We subtracts 1 from I

America is great ends the program

\$\endgroup\$
  • 2
    \$\begingroup\$ You could use multiplication. \$\endgroup\$ – ckjbgames Jan 24 '17 at 1:52
1
\$\begingroup\$

SmileBASIC, 20 bytes

FOR I=1TO 1E100?NEXT
\$\endgroup\$
1
\$\begingroup\$

Bash, 72 71 bytes

Prints 10^100 at signs.
Saved 1 byte thanks to @FlipTack.

printf '@%.0s' $(eval echo $(seq 1 $(echo 10^100 | bc | tr "\n" "\0"))) 

WARNING: This is probably extremely slow.


This is my first code golf, so I hope I did well.

\$\endgroup\$
  • \$\begingroup\$ I think you've misunderstood the question. You don't take the string to print as input, you can print any string you want a googol times, whatever string is shortest for you to print \$\endgroup\$ – FlipTack Jan 23 '17 at 22:54
  • \$\begingroup\$ @FlipTack Thanks! One byte saved. \$\endgroup\$ – ckjbgames Jan 23 '17 at 22:55
1
\$\begingroup\$

.COM, 21 bytes

0000h: 83 FC 9A 74 0B B9 10 27 51 E8 F4 FF 59 E2 F9 C3
0010h: B4 02 CD 21 C3                                 

    org 100h
f:  cmp sp, -2-4*25
    jz g
    mov cx, 10000
r:  push cx
    call f
    pop cx
    loop r
    ret
g:  mov ah, 2
    int 33
    ret       
\$\endgroup\$
0
\$\begingroup\$

ForceLang, 58 bytes

set k 10.pow 100
label a
set k k+-1
io.write 1
if k
goto a
\$\endgroup\$
0
\$\begingroup\$

Charcoal, 9 bytes

Note that Charcoal uses a custom codepage.

FX¹⁰¦¹⁰⁰D

Prints one googol newlines. Takes around 3.16887646×10⁹⁰ years to finish running.

Explanation

F        For
 X       Exponentiate
  ¹⁰¦¹⁰⁰  10, 100
D        Print (Dump) contents of canvas ("") plus newline

This will not freeze your computer (luckily!) because Charcoal has a 10ms minimum delay between prints by default. Charcoal used range as of this challenge's posting, therefore using more than 4GB of memory, but this has been fixed.

\$\endgroup\$
0
\$\begingroup\$

PHP7 (64-bit), 36 bytes

<?=bcsub(bcpow(10,bcpow(10,100)),1);

Should output 10^(10^100)-1 so 10^100 times the digit 9.

As of PHP 7.0.0, there are no particular restrictions regarding the length of a string on 64-bit builds. Source

\$\endgroup\$
  • \$\begingroup\$ I don't think there's enough RAM in the entire universe to complete this operation. I tried with only 1e10 and it stopped after it had allocated 5 GB and then tried to allocate 18.4 exabytes. I gave it 10GB, so I was a bit short :) \$\endgroup\$ – aross Nov 1 '16 at 10:15
0
\$\begingroup\$

Dip, 8 bytes

TT*T^(¹p

Prints googol newlines.

Explanation:

TT       # Pushes 10 twice
             # Stack: [10, 10]
  *      # Multiply 10 by 10
             # Stack: [100]
   T     # Push 10
             # Stack: [100, 10]
    ^    # Raise 10 to 100
             # Stack: [Googol]
     (   # Do Googol times
             # Stack: []
      ¹  # Push ""
             # Stack: [""]
       p # Print
             # Stack: []

Better version that puts to use some features released after this challenge: (4 bytes)

UX(q

Explanation:

U    # Push 100
         # Stack: [100]
 X   # Raise 10 to 100
         # Stack: [Googol]
  (  # Repeat Googol times
         # Stack: []
   q # Print a newline
         # Stack: []
\$\endgroup\$
0
\$\begingroup\$

05AB1E, 8 bytes

TTT*mFõ,

Prints googol newlines.

Try it online! (Not recommended)

Explanation:

TTT      # Push 10 three times
             # Stack: [10, 10, 10]
   *     # Multiply 10 by 10
             # Stack: [10, 100]
    m    # Raise 10 to 100
             # Stack: [Googol]
     F   # Do Googol times
             # Stack: []
      õ  # Push ""
             # Stack: [""]
       , # Print
             # Stack: []
\$\endgroup\$
  • \$\begingroup\$ Not recommended? More like won't run. \$\endgroup\$ – Magic Octopus Urn Jan 23 '17 at 17:46
0
\$\begingroup\$

VBA 117 bytes

Sub q():Dim x(100):While x(100)=0:Debug.Print:x(0)=x(0)+1:i=0:While x(i)>9:x(i)=0:i=i+1:x(i)=x(i)+1:Wend:Wend:End Sub

Invoke with q. Prints a googol newlines to immediate window. Easy to test by changing the "While x(100)" to say "While x(2)", which prints a hundred newlines.

I could use "MsgBox 0" in place of "Debug.Print" (saving 3 characters) but that would involve pressing return on the output more times than feasible, countering the whole idea of "program".

\$\endgroup\$
0
\$\begingroup\$

Groovy, 31 bytes

{Eval.me(it*"1${'0'*10**100}")}

\$\endgroup\$
0
\$\begingroup\$

Chip, 3815+3 = 3818 bytes

+3 byt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
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@'*|
 K aK
,xZ~<
`@','
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'|
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@'*|
 K eK
,xZ~<
`@','
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'`.
,xZ~<
`@' |
,xZ~<
`@' |
,xZ~<
`@','
,xZ<
`@'|
 K K
,xZ<
`@'`.
,xZ~<
`@' |
,xZ~<
`@' |
,xZ~<
`@' |
,xZ~<
`@' |
,xZ~<
`@','
,xZ<
`@'`.
,xZ~<
`@'*|
 K fK
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'|
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@' |
,xZ~<
`@','
,xZ<
`@'|
 K K
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@' |
,xZ~<
`@','
 K K
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@','
 K K
,xZ<
`@'`.
,xZ~<
`@' |
,xZ~<
`@','
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'`.
,xZ~<
`@'*}T
,xZ~<
`@','
 K K
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'`.
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'|
 K `K
,xZ~<
`@','
,xZ<
`@'|
,xZ<
`@'`.
,xZ~'
`@'

Try it online!

Oof.

It's a beeping massive binary counter: 333 bits are needed to express 1 googol, so there are 333 half-adders @ and 333 registers Z. (Actually only 100/log10(2) = ~332.2 bits are required, but this solution can't take advantage of those massive savings). There are also a few periodic caches K, which are required for this to even run correctly.

Note about the TIO: instead of using -w (which is a fake stdin consisting of infinite null bytes), it uses regular input. The result is that it terminates at the end of input, rather than attempting to outlive the universe by a factor of 1080.

The termination condition is encoded by the presence or absence of ~ near the Zs. If you worked from the bottom up, writing a '1' when you see a ~, and '0' when you don't, you'll have the binary representation for 1 googol.

Here is a TIO that only prints 100 times. This one does use -w, showing off the termination condition.

Also scattered around are *a, *e, and *f. These work together to produce an ASCII '1' for the output. If they were absent, null characters would be printed instead.

\$\endgroup\$
0
\$\begingroup\$

cQuents, 11 bytes

"#10^100::0

Given enough time (and memory, although it times out on TIO instead of running out of output space), will print 10^100 copies of whatever is to the right of 0.

Explanation

"             No join on output
 #10^100      Set n to 10^100
        ::    Print the sequence from 1 to n
          0   Each item in the sequence is 0

Try it online!

\$\endgroup\$
  • \$\begingroup\$ Note current version uses & instead of ::, saving 1 byte \$\endgroup\$ – Stephen Feb 1 at 4:54
0
\$\begingroup\$

HadesLang, 3153 bytes

I know this is really bad...but at least I tried, right?

for[num a in range:[0,99]]
for[num b in range:[0,99]]
for[num c in range:[0,99]]
for[num d in range:[0,99]]
for[num e in range:[0,99]]
for[num f in range:[0,99]]
for[num g in range:[0,99]]
for[num h in range:[0,99]]
for[num i in range:[0,99]]
for[num j in range:[0,99]]
for[num k in range:[0,99]]
for[num l in range:[0,99]]
for[num m in range:[0,99]]
for[num n in range:[0,99]]
for[num o in range:[0,99]]
for[num p in range:[0,99]]
for[num q in range:[0,99]]
for[num r in range:[0,99]]
for[num s in range:[0,99]]
for[num t in range:[0,99]]
for[num u in range:[0,99]]
for[num v in range:[0,99]]
for[num w in range:[0,99]]
for[num x in range:[0,99]]
for[num y in range:[0,99]]
for[num z in range:[0,99]]
for[num A in range:[0,99]]
for[num B in range:[0,99]]
for[num C in range:[0,99]]
for[num D in range:[0,99]]
for[num E in range:[0,99]]
for[num F in range:[0,99]]
for[num G in range:[0,99]]
for[num H in range:[0,99]]
for[num I in range:[0,99]]
for[num J in range:[0,99]]
for[num K in range:[0,99]]
for[num L in range:[0,99]]
for[num M in range:[0,99]]
for[num N in range:[0,99]]
for[num O in range:[0,99]]
for[num P in range:[0,99]]
for[num Q in range:[0,99]]
for[num R in range:[0,99]]
for[num S in range:[0,99]]
for[num T in range:[0,99]]
for[num U in range:[0,99]]
for[num V in range:[0,99]]
for[num W in range:[0,99]]
for[num X in range:[0,99]]
for[num Y in range:[0,99]]
for[num Z in range:[0,99]]
for[num aa in range:[0,99]]
for[num ba in range:[0,99]]
for[num ca in range:[0,99]]
for[num da in range:[0,99]]
for[num ea in range:[0,99]]
for[num fa in range:[0,99]]
for[num ga in range:[0,99]]
for[num ha in range:[0,99]]
for[num ia in range:[0,99]]
for[num ja in range:[0,99]]
for[num ka in range:[0,99]]
for[num la in range:[0,99]]
for[num ma in range:[0,99]]
for[num na in range:[0,99]]
for[num oa in range:[0,99]]
for[num pa in range:[0,99]]
for[num qa in range:[0,99]]
for[num ra in range:[0,99]]
for[num sa in range:[0,99]]
for[num ta in range:[0,99]]
for[num ua in range:[0,99]]
for[num va in range:[0,99]]
for[num wa in range:[0,99]]
for[num xa in range:[0,99]]
for[num ya in range:[0,99]]
for[num za in range:[0,99]]
for[num Aa in range:[0,99]]
for[num Ba in range:[0,99]]
for[num Ca in range:[0,99]]
for[num Da in range:[0,99]]
for[num Ea in range:[0,99]]
for[num Fa in range:[0,99]]
for[num Ga in range:[0,99]]
for[num Ha in range:[0,99]]
for[num Ia in range:[0,99]]
for[num Ja in range:[0,99]]
for[num Ka in range:[0,99]]
for[num La in range:[0,99]]
for[num Ma in range:[0,99]]
for[num Na in range:[0,99]]
for[num Oa in range:[0,99]]
for[num Pa in range:[0,99]]
for[num Qa in range:[0,99]]
for[num Ra in range:[0,99]]
for[num Sa in range:[0,99]]
for[num Ta in range:[0,99]]
for[num Ua in range:[0,99]]
for[num Va in range:[0,99]]
out:1
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
\$\endgroup\$
  • \$\begingroup\$ What is that supposed to be. Do you really need so many for loops. Also if possible provide a link so this can be tested / \$\endgroup\$ – Muhammad Salman Jun 1 '18 at 13:59
  • \$\begingroup\$ @Muhammad Salman Because Hades doesn't have a datatype for BigInts yet. Unfortunatly I can't provide a link to test this :/ \$\endgroup\$ – Azeros Jun 1 '18 at 14:02
  • \$\begingroup\$ Is the language stable and has it been released ? If it is you should probably have it added to TIO. Will make it a lot easier for link providing. \$\endgroup\$ – Muhammad Salman Jun 1 '18 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.