# Largest number in ten bytes of code

Your goal is to print (to the standard output) the largest number possible, using just ten characters of code.

• You may use any features of your language, except built-in exponentiation functions.
• Similarly, you may not use scientific notation to enter a number. (Thus, no 9e+99.)
• The program must print the number without any input from the user. Similarly, no reading from other files, or from the Web, and so on.
• Your program must calculate a single number and print it. You can not print a string, nor can you print the same digit thousands of times.
• You may exclude from the 10-character limit any code necessary to print anything. For example, in Python 2 which uses the print x syntax, you can use up to 16 characters for your program.
• The program must actually succeed in the output. If it takes longer than an hour to run on the fastest computer in the world, it's invalid.
• The output may be in any format (so you can print 999, 5e+100, etc.)
• Infinity is an abstract concept, not a number. So it's not a valid output.
• Did you look at these two? codegolf.stackexchange.com/questions/185/… codegolf.stackexchange.com/questions/18028/… – MadTux Jun 13 '14 at 13:35
• What do you exactly mean by "calculate". Also, If it takes longer than an hour to run on any computer in the world, it's invalid. is not objective. I could (theoretically) manufacture a computer that takes an hour to change one T-state – user80551 Jun 13 '14 at 13:37
• Does bit-shift count as an exponentiation operator since it is equivalent to * 2^x ? – Claudiu Jun 13 '14 at 16:08
• The fact that the time limit depends on the performance of the fastest computer in the world makes it impossible for us to determine the set of valid answers... I don't really like that – David Z Jun 13 '14 at 19:45
• @DavidZ: True. I'd like to see it changed to "1 hour on X computer", and also clarify the rules as to bit-shift, and whether other large built-in functions (e.g. ack in Wolfram) are allowed. I guess not the best question, but I enjoyed playing to the spirit of the rules – Claudiu Jun 13 '14 at 20:47

# Aceto

kτ\p******u


Prints out

1 * 10846 (2017)

1.1 * 10846 (2018)

1.3 * 10846 (2019)

6.89 * 1013537 (2019)

### Explanation

k - makes the stack 'sticky' so that values when popped are only copied,
not removed
τ - pushes the date on the stack (the year is on the top, 2017 right now...)
\ - escapes the next character (print)
p - (ignored on first go-around)
*
*
*
*        Multiplies top element by second, but stack has one element so it does it by itself
*
*
*
*
u - reverses instruction pointer direction
*
*
*
*
*
*
*
*
p - prints
\ - escapes the date
k - makes stack sticky


Try it online!

• actually you can add another * since p is excluded from bytecount – ASCII-only Apr 4 at 0:47

# Perl, 1.84467422290351e+26 (On a 64-bit machine)

perl -le "print ~0*9999999"

• Your code was the inspiration for my answer. – Zaid Jun 15 '14 at 14:25

$txr -p '(mask 999)' 535754303593133660474212524530000905280702405852766803721875194185175525562468061246 599189407847929063797336458776573412593572642846157810728751889829846429852761096554 990320661140395677219337642394922319490470301292036210344653556258987007434741839952 7286296858625998634149561158533358569939198279680  • What is this doing? – g.rocket Jun 16 '14 at 0:15 • @g.rocket It makes a bit mask in which bit 999 is set. It takes multiple arguments, e.g (mask 1 2) yields 6. – Kaz Jun 16 '14 at 2:12 ## C++ prints 18446744073709551615 # # ULLONG_MAX is 10 characters. #include <iostream> #include <limits.h> using namespace std; int main() { cout<<ULLONG_MAX<<endl; return 0; }  • And what value does that print? – Kyle Kanos Jun 14 '14 at 2:15 • @KyleKanos Fixed it, thanks – bacchusbeale Jun 14 '14 at 5:07 Bash / shell You may exclude from the 10-character limit any code necessary to print anything. ... you can use up to 16 characters for your program. (6 chars for code + 7 chars for printing = 26 digits) = 6888888 digits $ seq -s9 999999


This number is bigger, but people may argue that it's in the wrong format.

The output may be in any format (so you can print 999, 5e+100, etc.).

(8 chars for code + 8 chars for printing = 26 digits) = more than 1183888008 digits

\$ seq -s9 99999999


It usually takes around a minute to print the number and it contains the scientific representation of it.

Some funny example:

(10 chars = 26 digits)

echo $$2760127601276012760127601  • Your program must calculate a single number and print it. You can not print a string, nor can you print the same digit thousands of times. – aditsu Jun 14 '14 at 14:55 # Python 2.7 - 8794643931199480236 15616093818140822 print hash('zz')  • Um, that's 12 chars. – user80551 Jun 13 '14 at 19:48 • Ehh valid point @user80551. Guess I was slightly distracted by the footy match on TV :-) – Willem Jun 14 '14 at 6:17 Perl: 6.27710173538668e+57 on cygwin with a Perl 32 bit perl -e 'print ~0*~0*~0, "\n"'  # Ozone, 9e+90000 (1)n1n1s2  Though it depends on dialect. # JavaScript, more than 13 003 624 633 896 (but it reads a clock) 9*new Date  Reading from a clock is effectively taking an input. Feels like cheating. However, the technique seems to be well-received in the answers here. ### If clocks are not allowed, then: ## JavaScript, 186 025 771 008 99*(7<<28)  Trigonometry takes too many bytes (Math.sin, Math.PI). Bit-shift goes near the integer maximum, then multiplication yields a floating point. • Bit shift operation are limited to 32 bit integers. 60 == 28 used in a shift operation (try in console: [7<<28, 7<<60]) – edc65 Jun 13 '14 at 23:07 ## ><>, 3147440830160257032480100000000 319626579315078487616775634918212890625 Edit: Seems like I am allowed to exclude the characters needed for printing, the n in this case, so here is an updated version: ':*:*:*:*nÿ  Original answer: '*:*:*:*n;  Here, ' activates stringmode, and pushes all the following characters to the stack, before wrapping and exiting stringmode. Then it does a multiply-and-copy chain, printing the number, and exits. Of interest here is the ascii value of n 110, and ; 59. However, if we allow it to terminate with an error, we can abuse the fact that the official interpreter supports Unicode. The title of the question says bytes, but the text says characters, so the following program is just for the fun of it. '*:*:*:*n🿿  Outputting 1867215243681462552708446358738678532523702556144100000000 Alternatively, to stick to bytes, ÿ at the end gives us 383233022803952503175039062500000000, and that is still nice. (New "for fun" program ':*:*:*:*n🿿 prints 7587624076546380447593767884781979512738274729546264306618287972087303430335365121) # Brain-Flak, 100 (non-competing) (()@lt99)  Note that this code must be run with the -d flag which adds 3 bytes. Try it online! This uses the @lt debug flag in the ruby interpreter. This flag simply adds the following number to the value which is then pushed by the enclosing parentheses. The enclosing parentheses do not modify the number and are required for it to be printed so they are not counted towards then 10 bytes. The () adds one to the value and causes the interpreter to recognize the enclosing parentheses as pushing a value (parentheses will only push a value if they enclose non-debug flag Brain-Flak code. # Braingolf, I don't even know [non-competing] #~U&^^^^^^  Doesn't work on TIO as I need to get Dennis to pull, but as you can see here, U in Braingolf calculates a range from 1 to the last item on the stack, in this case ~ or 126 Then reduces the entire stack with exponentiation, meaning the stack now contains 1 value which is equal to 126^125^124...^2^1 We'll call this value n from now on. Then I had some bytes left, so I filled them with some monadic ^ operators. This means the final output is (((((n^n)^n)^n)^n)^n) For reference, 126^125 is 3.518180682714907e+262 and (126^125)^124 is ~35000 digits long # Tcl, number in the Demo Output because it is very extense (has 30104 digits) namespace path tcl::mathop puts [<< 9 99999]  The relevant part is << 9 99999  , the rest is boilerplate. Try it online! # APL (Dyalog) — largest representable number (only 3 bytes) This is the minimum reduction of an empty list: ⌊/⍬  ⌊ minimum / reduction ⍬ empty list When reducing an empty list, APL will return the identity element of the function used (if known). For minimum reduction of a system without infinities (e.g. ISO APL, to which Dyalog APL adheres), the identity element for minimum is the largest representable number: Try it online! (IEEE 754 64-bit floating-point) Try it online! (IEEE 754-2008 128-bit decimal floating-point) # Pyt, (only 6 bytes) 9!ḞɳƖ*  Try it online! Link to number I don't really see any point in getting any bigger than this. Anything else exceeds the runtime limit on TIO 9 pushes 9 ! factorial of 9 (362880) Ḟ push xth Fibonacci Number (really big) ɳ push 0123456789 ₫ reverse ("987654321") Ɩ cast to int ("987654321") * multiplies  # Runic This answer is only works, if the following things are true: 1. I implement the Ackermann function using a non stack overflowing implementation. • Which I did briefly last night, but removed as there is no useful reason to keep it • It did successfully calculate Ack(4,3) over the course of 20-30 seconds, a number with 19729 digits. 2. If there are no arbitrary execution limits (e.g. TIO's 60 second timeout) 3. The executing computer has an arbitrary amount of memory to store exceedingly large stacks of BigIntegers But if given those, then this program... 'ÿY:A:A:A@  ...prints a number so large simply calculating how many digits it has is impossible, due to the explosive nature of the Ackermann sequence. Heck the inputs to the first call are both 255000! The output (and thus input to the next call) is (in Knuth up-arrow notation): 2 ↑254998255003 - 3 (that's 254 BILLION arrows!) ## Explanation > Implicit entry 'ÿ Pushes the character ÿ onto the stack (which will be implicitly converted to an int whenever a math operator is called on it). Y Multiply by 1000 (the 'biggest' thing we can apply to a single stack value in 1 byte) : Duplicate top item on the stack A Pop x and y, call Ack(x,y) : Duplicate top item on the stack A Pop x and y, call Ack(x,y) : Duplicate top item on the stack A Pop x and y, call Ack(x,y) @ Print the entire stack, top to bottom (there's only 1 value) and terminate  ### Larger still? AAAAAAAA@  Push the character sequence A,A,A,A,A,A,A,A,@ onto the stack (9 items) as the instruction pointer begins a character sequence on  and loops around until it sees  again. Each A then invokes Ack(x,y) (where x is the top of the stack) until the stack contains 1 entry, printing it. Not sure if this is actually larger or not. ## However... The closest we can get by abiding by the limitations is this: ':pba,*@  (Note the non-printing character 0x8F in position 2) Try it online! Which prints 1.79657789596691E+308 (143143 * 1.1). The multiplier of 1.1 is the largest that can be applied without rolling over to infinity due to the limits on a double: even multiplying by a9, (1.11) is sufficient to trigger the infinity bit. # Wolfram Alpha (click) fib(99999)  = 1.60528...e20898. • This goes against the rule that says you can't get it from the Web. – Kyle Kanos Jun 14 '14 at 2:12 • I don't think so. Just because there is a web based REPL doesn't mean it retrieves the answer from the web. Look at wolfram.com/raspberry-pi for a Raspberry Pi based Wolfram Alpha that doesn't need internet access. – Jerry Jeremiah Jul 7 '15 at 12:46 # CJam - 40.4 million digits 1X27m<m<  Assuming bit shift is ok, this calculates 1<<(1<<27). It takes about 15 minutes on my laptop, using java 8 to run the interpreter. • Hey, aditsu, did you design CJam? – user19785 Jun 14 '14 at 8:57 • @404NotFound yeah, but a lot of it is like GolfScript – aditsu Jun 14 '14 at 14:01 • Cool, where did you learn parsing to write an interpreter? I'm really interested in parsing etc., but I'm only 12 (no CS courses ;() I'm currently reading "Parsing Techniques: a Practical Guide" and trying to write my toy compiler in C++ – user19785 Jun 14 '14 at 17:59 • @404NotFound I'm not sure I can answer exactly... my first experience with parsing was probably writing an arithmetic expression evaluator, and I learned that from a book or maybe somebody else's source code. In university I learned something about formal languages - finite automata, formal grammars (of different types) and parsing techniques. Then I read a few things on the net about some other types of parsers, and wrote some code to try things out, but I can't say I learned a lot, and I'm not really good at this. I designed CJam to be easy to parse, something like C++ is MUCH MUCH harder. – aditsu Jun 15 '14 at 8:18 • Of course I'm not trying to parse C++, I mean I write simple parsers in C++... In retrospect, was the university's class really crucial? Or did it have a more mild effect on your learning? – user19785 Jun 15 '14 at 9:26 ## units interactive shell, 3.085369e+68 You read that right, I know it's not much but it's definitely different. 9999Ypc ym  I'm assuming newline counts as a character and the invocation of units counts as code essential to print. Ypc is yotta parsec, ym is yocto meter. You have: 9999Ypc You want: ym * 3.085369e+68 / 3.2411034e-69  ## C#: 1.8E+19 Unfortunately we can't bit-shift doubles. using System; namespace BigNum10Bytes { class Program { static void Main() { // Playing with ulongs Console.WriteLine(ulong.MaxValue); Console.WriteLine(~(1UL<<64)); // 10 chars, 18446744073709551614 Console.WriteLine(8191UL<<51); // 10 chars, 18444492273895866368 Console.ReadLine(); } } }  # Cjam - alot alot: 99999999m!  even more: 9999999,m!  Unfortunately i cant calculate the result. But refering to wikipedia 14842907m! would be 2.788662975×10 ^ 100 000 000 • 99999,m!si should be much larger. – jimmy23013 Jul 7 '15 at 13:09 • @jimmy23013 but why the si? – TobiasR. Jul 7 '15 at 14:03 • To remove the leading zero... or just use two more 9s if that is allowed. – jimmy23013 Jul 7 '15 at 14:04 • @jimmy23013 ty for the hint, i think 9999999,m! could have won this challange (: – TobiasR. Jul 7 '15 at 14:08 • If my calculation is correct it's only about 10^(8.28*10^65657059). Those numbers from Ackermann functions are much much larger. – jimmy23013 Jul 7 '15 at 14:24 ## Befunge-93, ~2.49e+40 "**:*:*:*.  This works by pushing the ASCII values of the program onto the stack and doing a bunch of multiplication. Unfortunately, this doesn't work in TIO, but it does in this interpreter. Here is a worse version that actually works in TIO: "$$**:*:*.


And prints 1152921504606846976. TIO ended up pushing a lot of spaces and 2 zeroes at the end, so I had to get rid of those.

Note that both of these programs print the number forever, because the end command (@) would have taken up a precious byte.

# SmileBASIC, 8,589,934,592 274,877,906,944

?#RED*#RED


#RED is a constant for the color red (&HFFF80000)

The expression only takes up 9 characters, so I can print it in 10 characters without decreasing the number.

• You're not allowed to use exponential functions, unfortunately. – wizzwizz4 Feb 8 '17 at 19:46
• Oh, I can't believe I didn't see that. fixed. – 12Me21 Feb 8 '17 at 19:55
• Printing doesn't count in the count, so you'd be able to print it anyway. – wizzwizz4 Feb 8 '17 at 20:20
• I know, but I had 1 byte left over that I couldn't use for anything else – 12Me21 Feb 8 '17 at 20:30

# Python 2.7, approximately 10^10^10^8.56

9**9**9**9


1010108.56 is larger than a googolplex at 1010102, which means it has over a googol of digits, and thus easily exceeds all the other entries here except for possibly ack(9!,9!), I can't persuade Wolfram Alpha to tell me for sure.

However, through a series of approximations, I can arrive at the following true statements:

ack(9!,9!) < 2^362883362883
2^362883362883 < 2^10^11.56
2^10^11.56 < 10^10^11.56
10^10^11.56 < 10^10^10^8.56

• This is certainly smaller than ack(9!,9!). Let me assure you that. It's also smaller than this and this and this. – Simply Beautiful Art Jun 12 '17 at 1:30
• @SimplyBeautifulArt I can definitely agree that ack() rises more quickly, I just couldn't get Wolfram Alpha to display the value of that entry in a notation that I could directly compare. Those other three are definitely larger as well (I just didn't see them when I skimmed the set of answers). – Draco18s Jun 12 '17 at 14:54
• ack(9!,9!) > ack(4,4) + 3 = 2^2^2^2^2^2^2 > 9^9^9^9 – Simply Beautiful Art Jun 12 '17 at 15:09
• Except built-in exponentiation functions were explicitly excluded in the question. – Umbrella Nov 16 '17 at 13:23

# PHP, 14 bytes, 1.7196210584508E+308

ERA is a constant in PHP with the value131116

<?=ERA**60*15;


Try it online!

# PHP, 10 bytes, 1.1452524364115E+46

In real 10 Bytes

<?=ERA**9;


Try it online!

• Except built-in exponentiation functions were explicitly excluded in the question. – Umbrella Nov 16 '17 at 13:24

Wolfram

999999999!


Result:

9.90462657922299373728082110506570432171722139002... × 10^8565705513


Eight and a half billion digits!

This is the biggest I could find without using a named function such as "ack()".

• Why not 9!!!!!!!!!? Based on the accepted answer, I don't think anyone cares about run-time and physical constraints anymore. – Simply Beautiful Art Jun 12 '17 at 1:20
• Wolfram didn't like it when I put two factorial symbols consecutively, it seemed to be applying a different operation. Try it with 3!! and wolfram returns 3 as the answer instead of 720. A bug in wolfram? Do I win a prize ? :) – Wossname Jun 12 '17 at 6:52
• Apparently "double factorial" is a thing - but it doesn't do what I'd have expected. en.wikipedia.org/wiki/Double_factorial – Wossname Jun 12 '17 at 7:31
• See here on how to do the factorials. – Simply Beautiful Art Jun 12 '17 at 11:02
• What about ((999!)!)!? I don't know Wolfram, but I expect brackets are supported – Heimdall Nov 20 '17 at 7:00

# PHP , 11 bytes 1.9662705e+77

<?=9**9**9;

• This isn't INF, it's 1.9662705e+77 – Skidsdev Jun 9 '17 at 12:23
• How come !! Interpreter writes INF as a result – jahly Jun 9 '17 at 12:26
• because PHP can't handle a number that large (77 digits). Even if the output was actually infinity, see the last point of the spec Infinity is an abstract concept, not a number, so it's not a valid output – Skidsdev Jun 9 '17 at 12:29
• and it's not INF anyway :D – jahly Jun 9 '17 at 12:32
• Except built-in exponentiation functions were explicitly excluded in the question. – Umbrella Nov 16 '17 at 13:24

# Acc!!, 999999

19*3
Write _
Write _
Write _
Write _
Write _
Write _


As any code necessary to output anything is excluded, all 'Write ' statements are excluded.

Try it online!

# PHP, 9 bytes, MAX INT (9223372036854775807)

echo ~0^1<<63;


or

echo -1^1<<63;


Set an int of all bits on (-1) then XOR it with an int of only the first bit on to flip the sign bit.

# Stacked, 10 bytes ~ 2 × 10273964

17932!:*:*


Try it online! Snippet outputs the length, then the number itself.

This calculates (17932!)4 (without exponentiation) using scientific precision, so only a constant width is perpetuated. The number looks like:

204449781735459736090000000000000000...00000000000000000
`

This Wolfram|Alpha link shows what the precise calculation would look like.

• it's currently broken :( – ASCII-only Apr 4 at 0:46

## protected by Dennis♦Jun 14 '14 at 18:37

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).