77
\$\begingroup\$

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.
\$\endgroup\$
  • 4
    \$\begingroup\$ Did you look at these two? codegolf.stackexchange.com/questions/185/… codegolf.stackexchange.com/questions/18028/… \$\endgroup\$ – MadTux Jun 13 '14 at 13:35
  • 21
    \$\begingroup\$ 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 \$\endgroup\$ – user80551 Jun 13 '14 at 13:37
  • 4
    \$\begingroup\$ Does bit-shift count as an exponentiation operator since it is equivalent to * 2^x ? \$\endgroup\$ – Claudiu Jun 13 '14 at 16:08
  • 14
    \$\begingroup\$ 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 \$\endgroup\$ – David Z Jun 13 '14 at 19:45
  • 6
    \$\begingroup\$ 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. \$\endgroup\$ – WolframH Jul 7 '15 at 13:12

69 Answers 69

0
\$\begingroup\$

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!

\$\endgroup\$
  • \$\begingroup\$ > 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. \$\endgroup\$ – nonForgivingJesus Aug 10 at 13:50
0
\$\begingroup\$

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.

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

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.

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

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!

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

Javascript (ES6), 4E+30103

9n<<99999n

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

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

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

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

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

999999axxao

I'm trying to get the language on TIO

About 7.76227969 x 1018

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

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Kevin Cruijssen Aug 16 at 13:18
  • \$\begingroup\$ @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. \$\endgroup\$ – maxb Aug 16 at 13:21
  • \$\begingroup\$ @KevinCruijssen fixed and verified. \$\endgroup\$ – maxb Aug 16 at 14:38
0
\$\begingroup\$

Forth (gforth), 9 bytes, 7 bytes

-1. ud.

Try it online!

Produces: 340282366920938463463374607431768211455

\$\endgroup\$

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

Would you like to answer one of these unanswered questions instead?

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