146
\$\begingroup\$

Your goal is to write a program that prints a number. The bigger the number, the more points you'll get. But be careful! Code length is both limited and heavily weighted in the scoring function. Your printed number will be divided by the cube of the number of bytes you used for your solution.

So, let's say you printed 10000000 and your code is 100 bytes long. Your final score will be \$\frac {10000000} {100^3} = 10\$.

There are other rules to follow, in order to make this challenge a bit harder.

  • You cannot use digits in your code (0123456789);
  • You can use mathematical/physical/etc. constants, but only if they are less than 10. (e.g. You can use \$\pi \approx 3.14\$ but you can't use the Avogadro constant \$= 6\times 10^{23}\$)
  • Recursion is allowed but the generated number needs to be finite (so infinite is not accepted as a solution. Your program needs to terminate correctly, assuming unbounded time and memory, and generate the requested output);
  • You cannot use the operations * (multiply), / (divide), ^ (power) nor any other way to indicate them (e.g. 2 div 2 is not allowed);
  • Your program can output more than one number, if you need it to do that. Only the highest one will count for scoring;
  • However, you can concatenate strings: this means that any sequence of adjacent digits will be considered as a single number;
  • Your code will be run as-is. This means that the end-user cannot edit any line of code, nor he can input a number or anything else;
  • Maximum code length is 100 bytes.

Leaderboard

  1. Steven H., Pyth \$\approx f_{\Gamma_0+7}(256^{26})\$
  2. Simply Beautiful Art, Ruby \$\approx f_{\Gamma_0}(3)\$
  3. Peter Taylor, GolfScript \$\approx f_{\varepsilon_0+\omega+1}(17)\$
  4. r.e.s., GolfScript \$\approx f_{\varepsilon_0}^9(126)\approx f_{\varepsilon_0+1}(9)\$ [1]
  5. Simply Beautiful Art, Ruby \$\approx f_{\omega^{\omega2}+1}(126^22^{126})\$
  6. eaglgenes101, Julia \$\approx f_{\omega^3}(127)\$
  7. col6y, Python 3, \$\approx 127\to126\to\dots\to2\to1\approx f_{\omega^2}(127)\$ [1][3]
  8. Toeofdoom, Haskell, \$\approx a_{20}(1)\approx f_{\omega+1}(18)\$ [1]
  9. Fraxtil, dc, \$\approx 15\uparrow^{166665}15\$ [3]
  10. Magenta, Python, \$\approx\mathrm{ack}(126,126)\approx10\uparrow^{124}129\$
  11. Kendall Frey, ECMAScript 6, \$\approx1000\uparrow^43\$ [1]
  12. Ilmari Karonen, GolfScript, \$\approx10\uparrow^310^{377}\$ [1]
  13. Aiden4, Rust, \$\approx10\uparrow^3127\$
  14. BlackCap, Haskell, \$\approx10\uparrow\uparrow65503\$
  15. recursive, Python, \$\approx2\uparrow\uparrow11\approx10\uparrow\uparrow8.63297\$ [1][3]
  16. n.m., Haskell, \$\approx2\uparrow\uparrow7\approx10\uparrow\uparrow4.63297\$ [1]
  17. David Yaw, C, \$\approx10^{10^{4\times10^{22}}}\approx10\uparrow\uparrow4.11821\$ [2]
  18. primo, Perl, \$\approx10^{(12750684161!)^{5\times2^{27}}}\approx10\uparrow\uparrow4.11369\$
  19. Art, C, \$\approx10^{10^{2\times10^6}}\approx10\uparrow\uparrow3.80587\$
  20. Robert Sørlie, x86, \$\approx10^{2^{2^{19}+32}}\approx10\uparrow\uparrow3.71585\$
  21. Tobia, APL, \$\approx10^{10^{353}}\approx10\uparrow\uparrow3.40616\$
  22. Darren Stone, C, \$\approx10^{10^{97.61735}}\approx10\uparrow\uparrow3.29875\$
  23. ecksemmess, C, \$\approx10^{2^{320}}\approx10\uparrow\uparrow3.29749\$
  24. Adam Speight, vb.net, \$\approx10^{5000\times2^{256}}\approx10\uparrow\uparrow3.28039\$
  25. Joshua, bash, \$\approx10^{10^{15}}\approx10\uparrow\uparrow3.07282\$

Footnotes

  1. If every electron in the universe were a qubit, and every superposition thereof could be gainfully used to store information (which, as long as you don't actually need to know what's being stored is theoretically possible), this program requires more memory than could possibly exist, and therefore cannot be run - now, or at any conceiveable point in the future. If the author intended to print a value larger than ≈10↑↑3.26 all at once, this condition applies.
  2. This program requires more memory than currently exists, but not so much that it couldn't theoretically be stored on a meager number of qubits, and therefore a computer may one day exist which could run this program.
  3. All interpreters currently available issue a runtime error, or the program otherwise fails to execute as the author intended.
  4. Running this program will cause irreparable damage to your system.

Edit @primo: I've updated a portion of the scoreboard using a hopefully easier to compare notation, with decimals to denote the logarithmic distance to the next higher power. For example \$10↑↑2.5 = 10^{10^{\sqrt {10}}}\$. I've also changed some scores if I believed to user's analysis to be faulty, feel free to dispute any of these.

Explanation of this notation:

If \$0 \le b \lt 1\$, then \$a \uparrow\uparrow b = a^b\$.

If \$b \ge 1\$, then \$a \uparrow\uparrow b = a^{a \uparrow\uparrow (b-1)}\$.

If \$b \lt 0\$, then \$a \uparrow\uparrow b = \log_a(a \uparrow\uparrow (b+1))\$

An implementation of this notation is provided in Python that let's you test reasonably sized values.

\$\endgroup\$
18
  • 23
    \$\begingroup\$ Has someone explicitly said "base 10" yet? \$\endgroup\$
    – keshlam
    Commented Jan 9, 2014 at 14:42
  • 2
    \$\begingroup\$ Does the large number count if it's say 12e10 (12*10^10) as 12*10^10? \$\endgroup\$
    – hichris123
    Commented Jan 9, 2014 at 19:36
  • 6
    \$\begingroup\$ I think a better constraint instead of forbidding *, /, and ^, would've been to allow only linear operations, e.g. +, -, ++, --, +=, -=, etc. Otherwise, coders can take advantage of Knuth's up-arrow/Ackermann library functions if made available in their language of choice, which seems like cheating. \$\endgroup\$ Commented Jan 10, 2014 at 0:19
  • 26
    \$\begingroup\$ I'm still waiting to see someone earn footnote [4]. \$\endgroup\$ Commented May 18, 2017 at 15:41
  • 9
    \$\begingroup\$ Is a zero-byte program valid? \$\endgroup\$
    – pxeger
    Commented Oct 21, 2021 at 15:43

97 Answers 97

1 2 3
4
0
\$\begingroup\$

Python 3, score \$ \approx 10 \uparrow\uparrow 23.98622 \$

from math import *
x=pi;e=exp
for i in range(int(e(x))):x=e(x)
x=int(x)
print(str(x)*x)

Explanation

  1. Initialize x as pi.
  2. Repeat 23 times (int(e(x)) = 23): x = e(x).

This ends up as e^(e^(e^(...e^pi...))), with 23 "e^"s.

  1. Round down.
  2. Convert it to a string and repeat that string x times. I have no idea how much larger this makes the number, but it is much larger.

Sorry, I really have no idea how large this number is (even with up-arrow notation) or how to calculate that. :/ Mostly this answer was just to see what I could do. :)

\$\endgroup\$
2
  • \$\begingroup\$ Using the program linked at the end of the question, you can estimate your score as 10 ^^ 23.98622, where e(x) is taken as math.e ** x and str(x) * x is approximately x ** x. \$\endgroup\$ Commented Jun 18, 2022 at 0:40
  • \$\begingroup\$ Oh thanks! Sorry I didn't notice that link. \$\endgroup\$ Commented Jun 21, 2022 at 11:48
0
\$\begingroup\$

Python, at least \$10\uparrow\uparrow13\$ or \$10\uparrow\uparrow\uparrow 2\$

f=lambda x:''.join(str(x)for y in range(int(x)))
print(f(f(f(f(f(f(f(f(f(f(f(f(ord(""))))))))))))))

Unprintable character in ord function is 0x7f.

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ Isn't that function body just equivalent to str(x)*int(x)? \$\endgroup\$
    – Jo King
    Commented Aug 17, 2023 at 11:37
  • \$\begingroup\$ @JoKing yes but I can't use multiplication. \$\endgroup\$ Commented Aug 17, 2023 at 11:37
  • \$\begingroup\$ right, i suppose that would apply to string multiplication as well \$\endgroup\$
    – Jo King
    Commented Aug 17, 2023 at 11:39
0
\$\begingroup\$

Itr, approximately \$f_{\omega^3+f_{\omega^3}(191)}(f_{\omega^3}(191))\$

(newlines only for readability)

»áF»»Fä«°«¡«$©N
»»+ä«N©«$©a
"««¡N©"$r
»'aáF»"»»"à°r°«©«$©b
»'báF»"»»"à°r°«©«$©c
'¿c»c«N©

Explanation

a is the function form the previous solution with with n applications of äF to ä+ so \$a(n) \approx 2↑^nn \approx f_{\omega}(n)\$ in the fast-growing hierarchy.

The innermost layer of b (»»a««¡N©) applies a n-times to the input giving \$f_{\omega+n}(n) = f_{2\omega}(n)\$

The next layer will apply that function n-times to its own result giving \$f_{2\omega+n}(n) = f_{3\omega}(n)\$,

b does this n times, therefore \$b(n)\$ should be approximately \$ f_{n·\omega}(n) = f_{\omega^2}(n)\$.

c does the same thing as b but with b instead of a so \$c(n) \approx f_{n·\omega^2}(n) = f_{\omega^3}(n)\$

the last line applies c c(191) times to c(191)

Itr, score at least \$2↑^{48}126\$

using only constants, loops and linear functions.

'~äFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFäFä+

Explanation

The '~ at the start pushes the constant 126 (it is possible to increase the number by replacing ~ with the byte 0xbf = 191, but this would not make any significant impact on the total result while needing non-printable bytes)

Each äF applies the next function n times to n where n is the value currently on the stack.

ä+ will double the value that is currently on the stack, so the last äFä+ computes \$F_0(k)=2^k*k \approx 2↑k\$

Each äF now repeatedly applies the previous function to its own result, so äFäFe computes \$F_1(k) = {F_0}^k(k) \approx 2↑2 ... 2↑k \approx 2 ↑↑ k \$.

Each additional äF adds one additional arrow, so the final result should have the same order of magnitude as \$2↑^{48}126\$, dividing by 100³ will not significantly change that number.

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

Vyxal D, at least \$42781\underbrace{!!!!!…}_{42781\underbrace{!!!…}_{42781}\$

`\ꜝC`\¡\ꜝC¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ẋ+Ė→`\`\ꜝC\`\¡`←ẋ←`ẋ+Ė`←ẋ++Ė

I basically used factorial and string repetition to get some very large number. Outputs a RecursionError in the online interpreter, which it seems to do when you factorial a very very big number.

Try it Online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I've removed the excess MathJax. It would also be nice if you provided a more accurate score or at least some lower bound. \$\endgroup\$
    – Jo King
    Commented Sep 26, 2023 at 8:32
  • \$\begingroup\$ For me to remember: 42781 \$\endgroup\$ Commented Sep 26, 2023 at 14:15
0
\$\begingroup\$

brainfuck, 50 bytes - score approx 10^16,000,000

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

Try it online!

I decided to try to print a big number in brainfuck. On TIO, I ran a program to check the length of the tape - it's about 65,000 cells.

So, the number I output is approx:

$$ 10^{65000*255} $$

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

JavaScript (Node.js), 100 bytes

score: $$ 10↑^{10↑^{10↑^{10}10}10}10 $$

o=+!+[]
g=n=>n?(''+o+g(n-o)):o
k=(n,z)=>n?(z?k:g)(k(n-o,z),z-o):o
console.log(k(r=g(o),k(r,k(r,r))))

Try it online!

EDIT: After thinking it over, I concluded that I don't need to use BigInt for the following reason: both BigInt and regular int are going to be maxed out by the numbers needed to do the calculation, so I've used int, based on the assumption that MAX_SAFE_INTEGER large enough.

My code is based on the following functions:

$$ g(n) = 10^n $$ $$ k(n,z) = 10 ↑^{z+2} n $$

Thus, when z=0 we have tetration, when z=1 we have pentation etc.

Note that k is just a function, so after a bit of tweaking, I was able to pass the result from k() back into k() (twice).

As a result the code outputs the following number (approx)

$$ 10↑^{10↑^{10↑^{10}10}10}10 $$

I say approx because to save space, I only used 1's in the code.

The byte count is 100, which means a penalty of approx 1,000,000 which is negligible given the size of the number output.

EDIT #2: It bothered me that I couldn't test my code since it just maxes out the call-stack. So, what I did was to write some 'unit tests' - broke the code into pieces and test each in turn.

  1. Test g(n)
o=+!+[]
g=n=>n?(''+o+g(n-o)):o

console.log(`g(0) ${g(0)}`)
console.log(`g(1) ${g(1)}`)
console.log(`g(2) ${g(2)}`)

Try it online!

output:

g(0) 1
g(1) 11
g(2) 111
  1. Test k(n,z) with g(n) re-written so that:

$$ g(n) = 2^n $$

o=1n
g=n=>2n**n
k=(n,z)=>n?(z?k:g)(k(n-o,z),z-o):o

console.log(`k(0,0) ${k(0n,0n)}`)
console.log(`k(1,0) ${k(1n,0n)}`)
console.log(`k(2,0) ${k(2n,0n)}`)
console.log(`k(3,0) ${k(3n,0n)}`)
console.log(`k(4,0) ${k(4n,0n)}`)
console.log()
console.log(`k(0,1) ${k(0n,1n)}`)
console.log(`k(1,1) ${k(1n,1n)}`)
console.log(`k(2,1) ${k(2n,1n)}`)
console.log(`k(3,1) ${k(3n,1n)}`)
console.log()
console.log(`k(0,2) ${k(0n,2n)}`)
console.log(`k(1,2) ${k(1n,2n)}`)
console.log(`k(2,2) ${k(2n,2n)}`)

Try it online!

output:

k(0,0) 1
k(1,0) 2
k(2,0) 4
k(3,0) 16
k(4,0) 65536

k(0,1) 1
k(1,1) 2
k(2,1) 4
k(3,1) 65536

k(0,2) 1
k(1,2) 2
k(2,2) 4
\$\endgroup\$
-1
\$\begingroup\$

Python2

o=oct(ord('~'))
for a in range(int(o)):
    o+=o*int(o)
    for b in range(int(o)):
        o+=o*int(o)
o*int(o)

This is exactly 100 characters if the indentations are tabs.

In order for the program to output, it needs to be run in a python console rather than in a file.

Score is unknown at this point because the inner for loop will run 10e707 times in the first iteration of the outer loop. and in total, there will be 176 iterations of the outer loop. Also, this output is too big for me to even comprehend how to mark the notation for it.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Unnecessary spacing removed, there may be integer multiplication involved, there is nothing printed unless that's what the last line does, and the value of o*int(o) at the end should be approximately 10↑↑↑↑176. \$\endgroup\$ Commented May 18, 2019 at 19:30
  • \$\begingroup\$ For a small optimization, the third line should be moved up so that the outer loop runs more times. \$\endgroup\$ Commented May 18, 2019 at 19:37
1 2 3
4

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