User:Int-e/BFBB

From Esolang
Jump to navigation Jump to search

About

This is a Brainfuck busy beaver champion.

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

Update: The following shorter variant produces a slightly smaller number, but we analyse the above, earlier version first:

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

With wrapping cells, one can replace the >++++++ by >-.

Execution

The state of the program at the start of the outer loop has the shape

0 n1 n2 ... nk-1 *nk 0 1 ... 1 0

where n1...nk are positive integers, the pointer points to the nk and there are m 1-s to the right of the pointer.

If nk = 1, the loop changes this to the following, incrementing m by 1:

0 n1 n2 ... *nk-1 0 1 1 ... 1 0

Otherwise, the loop replaces the m 1-s by nk-1 and adds some more, smaller numbers, and sets m to 1:

0 n1 ... nk-1 1 1 nk-1 ... nk-1 nk-2 ... *1 0 1

Note that because m is stored in unary and the nk never increase, all cells stay in range 0..7 at all times.

Analysis

We can read the part to the left of the pointer as a stack for a program that evaluates

αn1∘...∘αnk(m)

where αn(m) is similar to the Ackermann function

α1(m) = 1+m
αn(m) = α1∘α1∘αn-1m∘αn-2∘...∘α1(1)

We can show by induction that

α2(m) = 3+m
α3(m) = 3m+4
α4(m) = 7·3m

The program evaluates

α7(0) = α1∘α1∘α5∘α4∘α3∘α2∘α1(1)
= 2 + α5(8135830269)
= 2 + α1∘α1∘α48135830269∘α3∘α2∘α1(1)
> 3 ↑ 8135830269

Analysis (new version)

The modified program executes in a similar way but it defines the function

β1(m) = 1+m
βn(m) = β1∘β1∘βn-1m∘βn-1∘...∘β2(1)

(Note the increased subscripts to the right.) We can show by induction that

βn(m) = αn(m+1) - 1

So

β6(0) = α6(1) - 1 = α7(0) - 1 > 3 ↑ 8135830269