Largest Number in Brainfuck BigInt for each program length up to 50 instructions

7

2

This challenge is for the largest finite number you can get BrainFuck programs of given lengths to contain in memory.

We must use one of the BF versions that uses big integers for the cells rather than byte values as not to be capped at 255. Do not use negative positions and values in memory. Do not use the BF instruction to input memory, also the output instruction is not needed.


Challenge:

Write Brainfuck programs with lengths from 0 to 50. Your score is the sum of each programs maximum value in memory.


As they may well be trivial feel free to omit the programs listed below and start from a length of 21, I'll use the following for the smaller sizes:

Length, Score, Program

0, 0
1, 1, +
2, 2, ++
3, 3, +++
Pattern Continues
10, 10, ++++++++++
11, 11, +++++++++++
12, 12, ++++++++++++
13, 16, ++++[->++++<]
14, 20, +++++[->++++<]
15, 25, +++++[->+++++<]
16, 30, ++++++[->+++++<]
17, 36, ++++++[->++++++<]
18, 42, +++++++[->++++++<]
19, 49, +++++++[->+++++++<]
20, 56, ++++++++[->+++++++<]

Total Score: 352


Related but different:

Large Numbers in BF

Largest Number Printable

Busy Brain Beaver

See the comments below for more info.



The combined results so far, being the sum of the best of each size:

length: 50
by l4m2

(262) - 2


length: 49
by l4m2

(212) - 2


length: 48
based on code by l4m2, by alan2here

(172) - 2


length: 39 to 47
based on code by l4m2, by alan2here

Σ (n = 4 to 12) of (fn(0) | f(x) := (4x+2 - 4) / 3)


length: 38
based on code by l4m2, by alan2here

(4^1366 - 4) / 3


length: up to 37 by alan2here

x |
  x > 6 ^ 20
  x > n
  x ≈ n
  n = 3,657,880,038,459,860

alan2here

Posted 2018-11-15T14:54:59.433

Reputation: 265

2

How is this challenge different from Large Numbers in BF ?

– TFeld – 2018-11-15T15:22:11.250

The Large Numbers question mentions "byte" several times, everyones answers use and rely on single bytes that wrap, this limits answers to trivial cases capped at 255. The program size of 20 at most also prevents the most optimal answer being anything beyond N, N * N or N * (N + 1). There is then almost no challenge at all. – alan2here – 2018-11-15T20:30:46.423

I think the different parameters of this challenge make it qualitatively different enough. The other question should be closed as dupe. – lirtosiast – 2018-11-15T21:15:59.463

4The other question says cells which can take on any integer value without overflowing, though it's impossible to actually get above 255 anyway. This extension seems like a more interesting question (that bans negative positions as well. I don't think eiher should be closed – Jo King – 2018-11-15T22:22:56.370

3

There's a close connection between true busy beavers (counting execution time) and largest value computers. Clearly calculating a large value by incrementation implies a long execution, but also a long execution implies the possibility of counting the steps to get a large number. Perhaps the closest previous question is in fact https://codegolf.stackexchange.com/q/4813/194 .

– Peter Taylor – 2018-11-16T23:04:54.533

Thanks Peter :) Very Interesting! Thats a hell of large upper limit on program size. :-o Good luck to even attempt that questions busiest beaver. – alan2here – 2018-11-17T10:05:15.400

1Unfortunately, only the last program really counts for anything with the bigger busy beavers, as there's no point adding the smaller programs to the total. It gets to the ppint where the number is so large that doubling or tripling it doesn't really matter – Jo King – 2018-11-21T13:59:19.577

Why move right at the end if it's the sum of each programs maximum value in memory? – l4m2 – 2018-11-22T12:01:25.323

Thank you :-/ I'll fix this. – alan2here – 2018-11-23T10:33:54.713

@lirtosiast feel free to attempt the best for any size, not just 50. It's interesting where the larger size starts to dominate the score, in the middle of the size range, perhaps at size 26 at time of writing. – alan2here – 2018-11-26T20:19:01.490

@lirtosiast The related and epic busy beaver function grows faster than any computable function, so truly optimal solutions to the sizes here could be ridiculously good. I think based on an answer for another question I've seen here that the ackermann function with a 3 digit rank should be possible easily inside 50 instructions. – alan2here – 2018-11-26T20:48:35.593

1Indeed, I wouldn't be surprised if that were the case. – lirtosiast – 2018-11-26T20:53:23.927

1Does the number have to be in the first data cell? Does the pointer have to end up on the cell where the number is? – Embodiment of Ignorance – 2018-11-28T21:36:08.780

1@EmbodimentofIgnorance I would say no and no, given that neither of those are true for the examples. – lirtosiast – 2018-11-28T23:41:24.693

Yet another similar question: https://codegolf.stackexchange.com/q/155850/39328

– lirtosiast – 2018-12-01T01:58:04.560

Answers

5

(262)-2

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

Where (42) = 2222

f20(0), where f(x):=(4x+2-4)/3

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

l4m2

Posted 2018-11-15T14:54:59.433

Reputation: 5 985

It can of course be larger, but just hard to express then – l4m2 – 2018-11-21T15:36:23.230

Your function appears to take 2 parameters? f<sup>n</sup>(m) What happens with the 16 in the calculation? Is this the same as (4^18 - 4) / 3 = about 23 billion? – alan2here – 2018-11-23T09:41:42.933

1@alan2here That means the result is fed into the function repeatedly, e.g. f(f(f(f(... 0)))) – Jo King – 2018-11-23T11:10:12.407

Thank you for the info. – alan2here – 2018-11-23T11:36:05.040

I think it's safe to assume that the 16 is generated by the 44 at the start of the code and credit you with a 54 version as well, what with the unnecessary last character, giving you best so far 49 and 50. :) – alan2here – 2018-11-23T12:32:55.610

Your approach well and truly dominates over ones I came up with for programs of 39 instructions or more. – alan2here – 2018-11-23T14:44:33.367

@alan2here f^3(0) is still fine as 8.646232293002308e+822 – l4m2 – 2018-11-23T15:10:12.917

@l4m2 What's the closest to 50 bytes you can get a program that meaningfully outscores this (>= 3 Knuth arrows)? I don't know Brainfuck so it's been a struggle for me. – lirtosiast – 2018-12-01T19:35:54.727

1

total: ≈ 172 - 2

The most dominant one in this total is based on a design by l4m2.

lengths: 0 to 12
{0, 1, 2, … 11, 12}

"", +, ++, +++
Pattern Continues
+++++++++++
++++++++++++
+++++++++++++

total: 78

lengths: 13 to 24
N × N
(N + 1) × N
16, 20, 25, 30, 36, 42, 49, 56, 64, 72, 81, 90

++++[->++++<]
+++++[->++++<]
+++++[->+++++<]
Pattern Continues
+++++++++[->++++++++<]
+++++++++[->+++++++++<]
++++++++++[->+++++++++<]

total: 581

total so far: 659


each yeild: fn(0) | f(x) = x × m + 1

lengths: 25
(m, n) = (5, 4)
156
>+>+>+>+<[>[-<+++++>]<<]>

length: 26
(m, n) = (4, 5)
341
>+>+>+>+>+<[>[-<++++>]<<]>

total: 497

total so far: 1156


each yeild: fr or (r × s)(0) | f(x) = (x + 1) × (p × q)

length: 27
(p, q, r) = (2, 2, 5)
1364
+++++[->+[->++<]>[-<++>]<<]

length: 28
(p, q, r) = (2, 2, 6)
5460
++++++[->+[->++<]>[-<++>]<<]

length: 29
(p, q, r) = (2, 2, 7)
21,844
+++++++[->+[->++<]>[-<++>]<<]

length: 30
(p, q, r) = (2, 2, 8)
87,380
++++++++[->+[->++<]>[-<++>]<<]

total: 116,048

total so far: 117,204

length: 36
(p, q, r, s) = (2, 3, 4, 4)
(≈ & >) (6 ^ 16 = 1,721,598,279,680)
++++[->++++<]
[->+[->+++<]>[-<++>]<<]

length: 37
(p, q, r, s) = (2, 3, 4, 5)
(≈ & >) (6 ^ 20 = 3,656,158,440,062,976)
+++++[->++++<]
[->+[->+++<]>[-<++>]<<]

total: (≈ & >) 3,657,880,038,342,656

total so far: (≈ & >) 3,657,880,038,459,860


Based a design by l4m2

each yeild: fn(0) | f(x) = (4x + 2 - 4) / 3

length: 38
n = 4
+++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 39
n = 4
++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 40
n = 5
+++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 41
n = 6
++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 42
n = 7
+++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 43
n = 8
++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 44
n = 9
+++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 45
n = 10
++++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 46
n = 11
+++++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

length: 47
n = 12
++++++++++++[->+[->+[->++<]>[-<++>]<<]<[->+<]>]

Based a design by l4m2
length: 48
++++[->++++<]>[->+[->+[->++<]>[-<+>]<<]<[->+<]>]

total: 172 - 2



Honorary Mention
(3 × 3) ^ 4
>+<++++[->[->+++<]>[-<+++>]<<]

alan2here

Posted 2018-11-15T14:54:59.433

Reputation: 265

0

Revision!

Even bigger numbers now!

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

Result: 1.1684220603446423e+69 or 116842206034464220000000000000000000000000000000000000000000000000000 (At least that's what the compiler says)

How?

How this works is that repeats the assignment v=v(4*3)^v 8 times(At least that's what I intended it to do.

Embodiment of Ignorance

Posted 2018-11-15T14:54:59.433

Reputation: 7 014

1Testing this the function looks as if it grows impressively, what function is it? Maybe you can win at one of the other sizes. – alan2here – 2018-11-29T18:36:59.243