# Largest number in ten bytes of code [closed]

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/… Jun 13, 2014 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 Jun 13, 2014 at 13:37
• Does bit-shift count as an exponentiation operator since it is equivalent to * 2^x ? Jun 13, 2014 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 Jun 13, 2014 at 19:45
• Exponentiation functions are not allowed, but ackermann function is allowed? That seems really arbitrary. It remains unclear why a symbolic manipulation is considered "calculating" the number. Jul 7, 2015 at 13:12

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

}
}
}


# 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. Jul 7, 2015 at 13:09
• @jimmy23013 but why the si? Jul 7, 2015 at 14:03
• To remove the leading zero... or just use two more 9s if that is allowed. Jul 7, 2015 at 14:04
• @jimmy23013 ty for the hint, i think 9999999,m! could have won this challange (: Jul 7, 2015 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. Jul 7, 2015 at 14:24

# 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. Feb 8, 2017 at 19:46
• Oh, I can't believe I didn't see that. fixed. Feb 8, 2017 at 19:55
• Printing doesn't count in the count, so you'd be able to print it anyway. Feb 8, 2017 at 20:20
• I know, but I had 1 byte left over that I couldn't use for anything else Feb 8, 2017 at 20:30

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. Jun 12, 2017 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 ? :) Jun 12, 2017 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 Jun 12, 2017 at 7:31
• See here on how to do the factorials. Jun 12, 2017 at 11:02
• What about ((999!)!)!? I don't know Wolfram, but I expect brackets are supported Nov 20, 2017 at 7:00

# 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 :( Apr 4, 2019 at 0:46

# x86_64 machine language (Linux) ~2.808896e+307

0:       f2 0f 10 05 fa ff ff    movsd  -0x6(%rip),%xmm0        # 2
7:       ff
8:       c3                      retq
9:       7f


This moves the IEEE-754 double precision float 7f c3 ff ff ff fa 05 10 to %xmm0 and returns.

Try it online!

# Javascript (ES6), 4E+30103

9n<<99999n


Uses big integers so actually goes way past what normal integers could reach.

# C (gcc), 9 * 10^4202512

printf("9%.*u",""); or printf("9%0*u","");

Try it online!

The shortest way to print anything in C (afaik) is puts(""); which is 9 bytes
19 - 9 = 10

.* specifies precision which isn't exponentiation

.number

For integer specifiers (d, i, o, u, x, X) − precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0. For e, E and f specifiers − this is the number of digits to be printed after the decimal point. For g and G specifiers − This is the maximum number of significant digits to be printed. For s − this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered. For c type − it has no effect. When no precision is specified, the default is 1. If the period is specified without an explicit value for precision, 0 is assumed.

https://www.tutorialspoint.com/c_standard_library/c_function_printf

So you'll get 9 followed by "" digits,(4202512)
the very last ones read from memory as the number to print is not specified,
adding ,0 would prevent memory reading but push it over the 10 byte limit

# 33, 7,762,279,691,451,941,920

999999axxao


I'm trying to get the language on TIO

# MathGolf, $$\\approx 1.609 \times 10^{1859933}\$$

9!!


Try it online!

With MathGolf being a language written in Python, the main issue will be calculating the number in a timely fashion. This program produces its output in about a minute. It might be possible to to $$\(10!)!\$$, which would be significantly bigger. However, the approach and the byte-count is still the same.

• This isn't valid I'm afraid. # isn't allowed because of the rule "You may use any features of your language, except built-in exponentiation functions." But even if you'd change it to *, I doubt it would be valid due to the rule "If it takes longer than an hour to run on the fastest computer in the world, it's invalid." Creating an array of timestamp!!!! amount of items in under an hour would be quite a feat. Aug 16, 2019 at 13:18
• @KevinCruijssen Oh, I should definitely have read the question more thouroughly... I'll think of another approach, and update the answer when I have one.
– maxb
Aug 16, 2019 at 13:21
• @KevinCruijssen fixed and verified.
– maxb
Aug 16, 2019 at 14:38

# Forth (gforth), 9 bytes, 7 bytes

-1. ud.


Try it online!

Produces: 340282366920938463463374607431768211455

# 1+, score 256

11+"*"*"*:


Begin with 2, square three times, and we get 256. I believe this is optimal.

# C++ (gcc) (x86/x86_64), 1.18973e+4932

Improvement on an answer from an inactive user.

#include <iostream>
#include <cfloat>
int main()
{
std::cout << LDBL_MAX+0 << std::endl;
}


Try it online!

Depends on the implementation, but x86 chips on Linux use an 80 bit extended double for long double. This results in LDBL_MAX being 1.18973e+4932, much larger than ULLONG_MAX.

• Just so you know, the +0 isn't required as you don't need to use all 10 bytes. You don't gain anything from removing it either, though. I'm just saying ;) Apr 14, 2021 at 1:46

# 05AB1E, $$\\Large>1.0111110111×10^{146,337}\$$

žmbbbbbbbb


Try it online! This is the only competing one, the alternative breaks rule 5.

žmbbbbbbbb  # full program
b  # convert...
žm          # 9876543210...
b         # in binary...
b        # in binary...
b       # in binary...
b      # in binary...
b     # in binary...
b    # in binary...
b   # in binary...
b  # to binary
# implicit output


# Alternative

This program scores: $$\large(r_{((x+1)^7-1)}=…(r_2=(r_1=x^x)^{r_1})^{r_2}…)^{r_{((x+1)^7-1)}}\\\Huge x=9{,}876{,}543{,}210$$Note: here, $$\\large r_2\$$ means the second result. So $$\\large r_{((x+1)^7-1)}\$$ means the $$\{\large{((x+1)^7-1)}}^\text{th}\$$ result.

žmEEEEEEEm


žmEEEEEEEm  # full program
E         # for N in [0, 1, ...,
žm          # ..., 9876543210...
E         # ]...
E        # for N in [0, 1, ...,
žm          # ..., 9876543210...
E        # ]...
E       # for N in [0, 1, ...,
žm          # ..., 9876543210...
E       # ]...
E      # for N in [0, 1, ...,
žm          # ..., 9876543210...
E      # ]...
E     # for N in [0, 1, ...,
žm          # ..., 9876543210...
E     # ]...
E    # for N in [0, 1, ...,
žm          # ..., 9876543210...
E    # ]...
E   # for N in [0, 1, ...,
žm          # ..., 9876543210...
E   # ]...
m  # push...
žm          # 9876543210...
# (implicit) or top of stack if not first iteration...
m  # to the power of...
žm          # 9876543210...
# (implicit) or top of stack if not first iteration

• I've removed most of the \large elements in the $\LaTeX$ as they're unnecessarily obtrusive Jul 12, 2021 at 22:59