# BigNum Bakeoff Reboot

Some of you may be familiar with the BigNum Bakeoff, which ended up quite interestingly. The goal can more or less be summarized as writing a C program who's output would be the largest, under some constraints and theoretical conditions e.g. a computer that could run the program.

In the same spirit, I'm posing a similar challenge open to all languages. The conditions are:

• Maximum 512 bytes.

• Final result must be printed to STDOUT. This is your score. If multiple integers are printed, they will be concatenated.

• Output must be an integer. (Note: Infinity is not an integer.)

• No built-in constants larger than 10, but numerals/digits are fine (e.g. Avogadro's constant (as a built-in constant) is invalid, but 10000 isn't.)

• The program must terminate when provided sufficient resources to be run.

• The printed output must be deterministic when provided sufficient resources to be run.

• You are provided large enough integers or bigints for your program to run. For example, if your program requires applying basic operations to numbers smaller than 101,000,000, then you may assume the computer running this can handle numbers at least up to 101,000,000. (Note: Your program may also be run on a computer that handles numbers up to 102,000,000, so simply calling on the maximum integer the computer can handle will not result in deterministic results.)

• You are provided enough computing power for your program to finish executing in under 5 seconds. (So don't worry if your program has been running for an hour on your computer and isn't going to finish anytime soon.)

• No external resources, so don't think about importing that Ackermann function unless it's a built-in.

All magical items are being temporarily borrowed from a generous deity.

## Extremely large with unknown limit

where B³F is the Church-Kleene ordinal with the fundamental sequence of

B³F[n] = B³F(n), the Busy Beaver BrainF*** variant
B³F[x] = x, ω ≤ x < B³F


1. Simply Beautiful Art, Ruby fψ0(X(ΩM+X(ΩM+1ΩM+1)))+29(999)

2. Binary198, Python 3 fψ0Ωω+1)+1(3) (there was previously an error but it was fixed)

3. Steven H, Pyth fψ(ΩΩ)+ω²+183(25627!)

4. Leaky Nun, Python 3 fε0(999)

5. fejfo, Python 3 fωω6(fωω5(9e999))

6. Steven H, Python 3 fωω+ω²(99999)

7. Simply Beautiful Art, Ruby fω+35(9999)

8. i.., Python 2, f3(f3(141))

## Some side notes:

If we can't verify your score, we can't put it on the leaderboard. So you may want to expect explaining your program a bit.

Likewise, if you don't understand how large your number is, explain your program and we'll try to work it out.

If you use a Loader's number type of program, I'll place you in a separate category called "Extremely large with unknown limit", since Loader's number doesn't have a non-trivial upper bound in terms of the fast growing hierarchy for 'standard' fundamental sequences.

Numbers will be ranked via the fast-growing hierarchy.

For those who would like to learn how to use the fast growing hierarchy to approximate really large numbers, I'm hosting a Discord server just for that. There's also a chat room: Ordinality.

Similar challenges:

Largest Number Printable

Golf a number bigger than TREE(3)

Shortest terminating program whose output size exceeds Graham's number

For those who want to see some simple programs that output the fast growing hierarchy for small values, here they are:

### Ruby: fast growing hierarchy

#f_0:
f=->n{n+=1}

#f_1:
f=->n{n.times{n+=1};n}

#f_2:
f=->n{n.times{n.times{n+=1}};n}

#f_3:
f=->n{n.times{n.times{n.times{n+=1}}};n}

#f_ω:
f=->n{eval("n.times{"*n+"n+=1"+"}"*n);n}

#f_(ω+1):
f=->n{n.times{eval("n.times{"*n+"n+=1"+"}"*n)};n}

#f_(ω+2):
f=->n{n.times{n.times{eval("n.times{"*n+"n+=1"+"}"*n)}};n}

#f_(ω+3):
f=->n{n.times{n.times{n.times{eval("n.times{"*n+"n+=1"+"}"*n)}}};n}

#f_(ω∙2) = f_(ω+ω):
f=->n{eval("n.times{"*n+"eval(\"n.times{\"*n+\"n+=1\"+\"}\"*n)"+"}"*n);n}


etc.

To go from f_x to f_(x+1), we add one loop of the n.times{...}.

Otherwise, we're diagonalizing against all the previous e.g.

f_ω(1) = f_1(1)
f_ω(2) = f_2(2)
f_ω(3) = f_3(3)

f_(ω+ω)(1) = f_(ω+1)(1)
f_(ω+ω)(2) = f_(ω+2)(2)
f_(ω+ω)(3) = f_(ω+3)(3)


etc.

• Do numerals count as built-in constants? Nov 24, 2017 at 22:34
• @CloseVoters How can this be too broad... Well, asking the user to output one number in infinitely many numbers is not the same as asking the user to choose one of infinitely many tasks to do. To be fair this question ask the user to do the same thing too. 4 close votes as too broad already... Nov 26, 2017 at 2:13
• @Οurous Yes, you may assume that. But realize that when your program is given more resources, including faster computation, the output must still be deterministic. Dec 9, 2017 at 1:40
• I stated in the other comment section why I think the bounded Brainfuck Busy Beaver function will be exponential, but I'd like to add that more generally, I don't think the Church-Kleene ordinal will be the appropriate level for any computer program. A function one can code with a program are computable, and so should fall into the provably recursive functions of some sufficiently strong recursive sound theory. That theory will have a recursive proof theoretic ordinal, and that function will be below that ordinal in the FGH, assuming reasonable fundamental sequences. Dec 13, 2017 at 6:28
• Of course the actual Busy Beaver function cannot be coded into program (hypercomputational languages aside), and restricted Busy Beaver functions that can be programmed must by necessity be much slower growing. Dec 13, 2017 at 6:30

# Ruby, fψ0(X(ΩM+X(ΩM+1ΩM+1)))+29(999)

where M is the first Mahlo 'ordinal', X is the chi function (Mahlo collapsing function), and ψ is the ordinal collapsing function.

f=->a,n,b=a,q=n{c,d,e=a;!c ?[q]:a==c ?a-1:e==0||e&&d==0?c:e ?[[c,d,f[e,n,b,q]],f[d,n,b,q],c]:n<1?9:!d ?[f[b,n-1],c]:c==0?n:[t=[f[c,n],d],n,c==-1?[]:d==0?n:[f[d,n,b,t]]]};(x=9**9**9).times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{h=[];x.times{h=[h,h,h]};h=[[-1,1,[h]]];h=f[h,p x*=x]until h!=0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}


Try it online!

### Code Breakdown:

f=->a,n,b=a,q=n{          # Declare function
c,d,e=a;          # If a is an integer, c=a and d,e=nil. If a is an array, a=[c,d,e].compact, and c,d,e will become nil if there aren't enough elements in a (e.g. a=[1] #=> c=1,d=e=nil).
!c ?[q]:          # If c is nil, return [q], else
a==c ?a-1:          # If a==c, return a-1, else
e==0||e&&d==0?c:          # If e==0 or e is not nil and d==0, return c, else
e ?[[c,d,f[e,n,b,q]],f[d,n,b,q],c]:          # If e is not nil, return an array inside an array, else
n<1?9:          # If n<1, return 9, else
!d ?[f[b,n-1],c]:          # If d is nil, return [f[b,n-1],c], else
c==0?n:          # If c==0, return n, else
[t=[f[c,n],d],n,c==-1?[]:d==0?n:[f[d,n,b,t]]]          # t=[f[c,n],d]. If c==-1, return [t,n,[]], else if d==0, return [t,n,n], else return [t,n,[f[d,n,b,t]]].
};          # End of function
(x=9**9**9)          # Declare x
x.times{...}          # Looped within 33 x.times{...} loops
h=[];          # Declare h
x.times{h=[h,h,h]};          # Nest h=[h,h,h] x times
h=f[h,p x*=x]          # Apply x*=x, print x, then h=f[h,x]
until h==0          # Repeat previous line until h==0


### Math Breakdown:

f reduces a based on n,b,q.

The basic idea is to have an extremely nested a and reduce it repeatedly until it reduces down to a=0. For simplicity, let

g[0,n]=n
g[a,n]=g[f[a,n],n+1]


For now, let's only worry about n.

For any integer k, we get f[k,n]=k-1, so we can see that

g[k,n]=n+k


We then have, for any d, f[[0,d],n]=n, so we can see that

g[[0,d],n]
= g[f[[0,d],n],n+1]
= g[n,n+1]
= n+n+1


We then have, for any c,d,e, f[[c,0,e],n]=f[[c,d,0],n]=c. For example,

g[[[0,d],0,e],n]
= g[f[[[0,d],0,e]],n+1]
= g[[0,d],n+1]
= (n+1)+(n+1)+1
= 2n+3


We then have, for any c,d,e such that it does not fall into the previous case, f[[c,d,e],n]=[[c,d,f[e,n]],f[d,n],e]. This is where it starts to get complicated. A few examples:

g[[[0,d],1,1],n]
= g[f[[[0,d],1,1],n],n+1]
= g[[[0,d],1,0],0,[0,d]],n+1]
= g[f[[[0,d],1,0],0,[0,d]],n+1],n+2]
= g[[[0,d],1,0],n+2]
= g[f[[[0,d],1,0],n+2],n+3]
= g[[0,d],n+3]
= (n+3)+(n+3)+1
= 2n+7

#=> Generally g[[[0,d],1,k],n] = 2n+4k+3

g[[[0,d],2,1],n]
= g[f[[[0,d],2,1],n],n+1]
= g[[[[0,d],2,0],1,[0,d]],n+1]
= g[f[[[[0,d],2,0],1,[0,d]],n+1],n+2]
= g[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2]
= g[f[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2],n+3]
= g[[[[0,d],2,0],1,n+1],n+3]
= ...
= g[[[0,d],2,0],3n+6]
= g[f[[[0,d],2,0],2n+6],3n+7]
= g[[0,d],3n+7]
= (3n+7)+(3n+7)+1
= 6n+15


It quickly ramps up from there. Some points of interest:

g[[[0,d],3,[0,d]],n] ≈ Ack(n,n), the Ackermann function
g[[[0,d],3,[[0,d],0,0]],63] ≈ Graham's number
g[[[0,d],5,[0,d]],n] ≈ G(2^^n), where 2^^n = n applications of 2^x, and G(x) is the length of the Goodstein sequence starting at x.


Eventually introducing more arguments of the f function as well as more cases for the array allows us to surpass most named computable notations. Some particularly known ones:

g[[[0],3,[0,d]],n] ≈ tree(n), the weak tree function
g[[[[0],3,[0,d]],2,[0,d]],n] ≈ TREE(n), the more well-known TREE function
g[[[[0,d]],5,[0,d]],n] >≈ SCG(n), sub-cubic graph numbers
g[[[0]],n] ≈ S(n), Chris Bird's S function

• Ordinal explanation? Dec 9, 2017 at 2:55
• Is this your largest defined number yet? It appears so! Sep 28, 2019 at 3:47
• This looks quite powerful, but can you prove your supposed growth rate of $\psi_0(\chi(\Omega_{M+\chi(\Omega_{M+1}^{\Omega_{M+1}}))})+29$? That seems quite high in my opinion. But I might be wrong, your program might actually be that strong! Nov 21, 2021 at 9:25
• Also, which OCF are you using? The analysis seems ill-defined. Dec 11, 2021 at 15:19

# Pyth, fψ(ΩΩ)+ω2+183(~25627!)

=QC.pGL&=^QQ?+Ibt]0?htb?eb[Xb2yeby@b1hb)hbXb2yeb@,tb&bQ<b1=Y_1VQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQVQ.v%%Fms["*s[.v"*\\^2d"\"%s"*\\^2d"\"")Qs["=Y.v+*"*\\^2Q"\"*3]"*\\^2Q"\"Q\YuyFYHpQ)


Requires any non-empty input, but the value thereof is not used.

Explanation (for the new and actually-reasonably-scoring version):

=QC.pG                   Sets the value of the autofill variable to app. 256^27!
27! ~= the number of characters in the string
containing all permutations of the alphabet.
We interpret that string as a base-256 number.
L                  Define a function y(b,global Q):
&=^QQ             Set Q to Q^Q and:
?+Ibt]0           If (?) the variable (b) is (I)nvariant on (+)adding itself
to the empty array (i.e. if it's an array itself):
?htb        If the second element of b is not 0:
?eb         If the last element is not 0
[Xb2yeby@b1hG)   return [b with its last element replaced with y(b[-1]), y(b[1]), b[0]]
hb                 else return b[0]
Xb2yeb     else return b with its last element replaced with y(b[-1])
@,tb&bQ<b1      If b isn't an array,return:
either b-1 if it's a standard ordinal (1 or more)
or Q if b is ω
or 0 if b is 0
=Y_1                          Set the global variable Y to -1 (representing ω)
VQ                        Q times, do (the rest of the explanation):
VQVQ....VQ               Iterate from 0 to Q-1 183 times, each subiteration
reading the most recent value of Q when it starts:
.v%%Fms["*s[.v"*\\^2d"\"%s"*\\^2d"\"")Q
Iterate from 0 to Q-1 Q times, each subiteration
reading the most recent value of Q when it starts:
s["=Y.v+*"*\\^2Q"\"*3]"*\\^2Q"\"Q
Y = [Y,Y,Y] Q times, stacking with previous iterations.
uyFYHpQ)                    Run y_x(Y) for x incrementing until y_(x-1)(Y)=0


It's very hard for me to compute the size of this, mostly because it's late in the day and I'm not super familiar with fast-growing hierarchies or how I'd even go about trying to figure out how many times Q goes through the y() wringer. While I now know more about ordinals, I still have no idea how to calculate the value of the ordinal represented by the recursive definition in my program. I'd join the Discord server, but that's under a pseudonym I'd rather not be linked to my real name.

Unfortunately, because I know relatively little about said fast-growing hierarchies, I'm likely to have already lost to the Ruby answer. It's hard for me to tell. I may have beaten the Ruby answer, but I'm not 100% sure. ¯\_(ツ)_/¯

• If I understand correctly, your score is probably somewhere in the ballpark of 27^^^27^^27^^4, or f<sub>4</sub>(27^^27^^4)) ≈ f<sub>4</sub>(f<sub>3</sub>(f<sub>3</sub>(19))). Nov 25, 2017 at 15:22
• I made a small change that I should have thought of yesterday, but somehow didn't - making y recurse to operate on y(Q-1) instead of operating just on Q. How does this affect the score? Nov 25, 2017 at 19:13
• I'm not entirely sure what's going on. Does y(Q) = L(y(Q-1)), per se? Nov 25, 2017 at 19:18
• I think we'll have better luck doing this in a chatroom. Nov 25, 2017 at 19:22
• @SimplyBeautifulArt Its probably best not to use fast growing hierarchy notation for this, since its kind of small. Nov 27, 2017 at 1:25

# Pyth, f3+σ-1+ω2(25626)

Where σm[n] is the Busy Beaver function Σ of order m called on n: σm[n] = Σm(n). The order -1 is to denote that the Busy Beaver here is not being called on a true Turing Machine, but rather an approximation with a finite wrapping tape of Q elements. This allows the halting problem to be solvable for these programs.

=QCGM.x-Hlhf!-/T4/T5.__<GH0M.x+Hlhf!-/T4/T5._>GHlGL=.<QCm.uX@[XN2%h@N2l@N1XN2%t@N2l@N1XN1X@N1@N2%h@@N1@N2l@N1XN1X@N1@N2%t@@N1@N2l@N1XW!@@N1@N2N2nFKtPNXW@@N1@N2N2gFK)@hNeN3%heNlhNd)bLym*F[]d^UQQUQUld)^U6QJ"s*].v*\mQ"
.v+PPPP*JQ"+*\mQ\'


The TL;DR is that this creates all possible BrainF**k programs of length Q, runs them in an environment where the maximum value of an integer is Q and the tape length is Q, and compiles all the states from these operations together to append (that's the 3+) to Q, repeating the above on a scale of fω2.

I still have ~half the characters to work with if I wanted to do something more, but until we figure out where this is I'll just leave it as is.

• I made a sorta better explanation of σ in the leaderboard. Dec 13, 2017 at 1:54
• It doesn't look to me like this particular Busy Beaver function an be that fast growing. With a limit of Q integers between 0 and Q, there are only (Q+1)^Q possible tapes, and Q possible positions in the program, so there can be at most Q*(Q+1)^Q possible states of a running program. So a program must halt within Q*(Q+1)^Q steps or not at all. The number of possible programs is also limited by an exponential upper bound. So it looks to me like this Busy Beaver function has an exponential upper bound, and the final function will be on the order of $f_{\omega^2}$. Dec 13, 2017 at 6:17

# Python 3, probably fε0(99) I have no idea

def f(n,d,a,i):
if d < 0 or i >= len(a):
return n

k = a[i]
if type(k) == int:
if k < 0:
a[i] = [-2]*n
a = f(n,d,a,i+k+2)
else:
a[i] -= 1
else:
a[i] = f(n,d-1,k,0)
return a

def g(n):
d=n
a=[-2]*n
while type(a) != int:
a = f(n,d,a,0)
n += 1

print(g(99))


Edit: Accidentally left d=2 from the slower-growing format, fixed and it's now d=n.

Try it online!

First, this is my first CGSE post (and my first SE post in general) so this definitely looks weird. Second, I'm not sure it's fε0(99) I have no idea what this is. Third, I did no golfing on this, just trying to get something out there that I can understand (and build upon in later edits). I consider this to be "v0.1",

## Equivalent equation

Fourth, I'm not sure that g(n) grows at fε0. I sent it to the mathematics stackex discord, and ended up making an approximation of this program.

$$\g(n) = f(n,n,\{-2,-2,\cdots\ n\ times\},0)\\a=\{a_0,a_1,\cdots a_k\}\$$

$$\f(n,d,a,i) =\left\{ \begin{array}{cl} n & : \ d < 0 \\ n & : \ i > k\\ f(n,d,\{a_0,\cdots a_{i-1},\{-2,-2,-2,\cdots n\ times\},a_{i+1}\cdots a_k \},i+k+2) & : \ a_i \in \mathbb{Z}\ \cap\ a_i<0\\ f(n+1,d-1,\{a_0\cdots a_{i-1},a_i-1,a_{i+1},\cdots a_k\},0) & : \ a_i \in \mathbb{Z}\ \cap\ a_i\geq 0 \\ \{a_0,a_1\cdots a_{i-1},f(n,d-1,a_i,0),a_{i+1},\cdots a_k\}&:\ a_i\notin\mathbb{Z} \end{array} \right.\$$

If f(n,d,a,i) is cutting off on the side of the screen, then use these links to an image of the equation, both with a White background and with a Discord Dark Mode background.

## Slower growing formats

Lastly, while testing it, to make sure it worked, I made a version that grows significantly slower.

Slower growing function. For this, it increments an unrelated q variable instead of incrementing n directly, then outputs q. With n=2 and d=2, it outputs 714025. With n=3 and d=2 or n=2 and d=3, tio.run gives me a "Program has exceeded the 60 second time limit."

def f(n,d,a,i):
if d < 0 or i >= len(a):
return n

k = a[i]
if type(k) == int:
if k < 0:
a[i] = [-2]*n
a = f(n,d,a,i+k+2)
else:
a[i] -= 1
else:
a[i] = f(n,d-1,k,0)
return a

n=3
d=2
a=[-2]*n
q=0

while type(a) != int:
a = f(n,d,a,0)
q += 1

print(q)

• Welcome to Code Golf, and nice answer! Jan 15, 2022 at 18:44