# Output a googol copies of a string

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;
}

• Consider the sandbox first next time. – cat Oct 29 '16 at 18:44
• When you post a new question, you are asked to first post it in the sandbox. – flawr Oct 29 '16 at 18:48
• @KritixiLithos It was toying with that idea but I could not quickly come up with a sample solution. Feel free to make a sequel :-) – The Vee Oct 29 '16 at 19:16
• @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". – dorukayhan Oct 29 '16 at 23:47
• TIL Googol-1 in Roman numerals – mbomb007 Oct 31 '16 at 18:36

# Pyth, 8 7 bytes

V^T100G


Solution is tested with small output, but it should print abcdefghijklmnopqrstuvwxyz 1e100 times.

For some reason, the p was unneeded, as 31343 (Maltysen) said.

• Why is the p needed? – Maltysen Oct 30 '16 at 3:26
• @Maltysen I think because of the 4 GB limit. – Erik the Outgolfer Oct 30 '16 at 6:18
• Why? Cuz of the buffer? Doesn't that automatically flush? – Maltysen Oct 30 '16 at 16:04
• @Maltysen I don't know, the online interpreter does not have immediate output functionality. It might flush, it might not... – Erik the Outgolfer Oct 30 '16 at 16:08
• Its working locally without the p – Maltysen Nov 1 '16 at 23:03

# 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
• 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. – ckjbgames Jan 23 '17 at 22:27
• @ckjbgames wrong. Ever tried running code with php -r? In any case, here's the relevant discussion about that. – aross Jan 24 '17 at 8:49
• You would need to if it was meant to be on a webpage. – ckjbgames Jan 24 '17 at 14:15

# 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.

# Zsh, 26 bytes

eval repeat\ a{0..99}+10 @


Try it online!

-2 thanks to @GammaFunction

• repeat\ a{0..99}+10: construct the string repeat a0+10 repeat a1+10 ... repeat a99+10
• a0 through a99 are undefined and are treated as 0, so a0+10 always evaluates to 10
• append @
• evaluate that string, which is 100 nested loops and then on each iteration we execute the command @, which doesn't exist, so it prints (eval):1: command not found: @

To be perfectly honest, I'm surprised the existing shell answers are so bad

• You can remove the last escaped space for 26 bytes. – GammaFunction Feb 7 at 3:33

## Common Lisp, 33

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


Print newlines.

# 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

• Yes, necessary imports are always counted. – cat Oct 30 '16 at 21:08

## 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).

• dotimes requires long as a parameter doesn't it? – cliffroot Oct 31 '16 at 10:12
• It works with any N that returns TRUE for (number? N), rounding or dropping fractions when needed. – Michael M Oct 31 '16 at 11:33
• 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 – cliffroot Oct 31 '16 at 11:41
• You are right, I had an overwritten core dotimes with some math package. I will edit with something that works in a moment. – Michael M Oct 31 '16 at 11:54

## Common Lisp, 37 bytes

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


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

# 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: []


# 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.

# C# - 127123 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.

• You can golf it by 1 byte by changing n>0;n-- to n-->0;. +1 for the rest. :) – Kevin Cruijssen Oct 31 '16 at 14:53
• @KevinCruijssen I can also save bytes by turning this into a shorter function, since OP didn't mention "full program". Thanks! :) – Yytsi Oct 31 '16 at 17:07
• Also you can change your using to using b= System.Numerics.BigInteger and use the alias in the rest of the code – user19547 Nov 3 '16 at 22:13
• 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. :) – user19547 Nov 3 '16 at 22:23
• @Phaeze Thanks! Haven't even edited the previous edit in yet, but will do today :) – Yytsi Nov 4 '16 at 4:46

# 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.

# 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.

• 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. – ckjbgames Jan 23 '17 at 22:23

# 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.

# 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.

# 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

• 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. – FlipTack Jan 23 '17 at 22:57
• @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. – user45941 Jan 23 '17 at 23:01
• 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. – FlipTack Jan 25 '17 at 21:03
• I meant 1.25 x 10^87 (missed the exponent) – FlipTack Jan 26 '17 at 10:29

# 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

• You could use multiplication. – ckjbgames Jan 24 '17 at 1:52

# SmileBASIC, 20 bytes

FOR I=1TO 1E100?NEXT


# Bash, 72 71 bytes

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

# Chip, 3815+3 = 3818 bytes

+3 bytes for flag -w

 *
,xZ.
@'|
,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<
@'|
,xZ<
@'|
K K
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
K K
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
,xZ<
@'|
K K
,xZ<
@'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.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.

# 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!

• Note current version uses & instead of ::, saving 1 byte – Stephen Feb 1 '19 at 4:54