Here's a 41-character program that eventually halts, leaving more than 10↑(10↑28) contiguous cells set equal to 1 (so the number of instructions executed is very much greater than that):
>+>+>+>+[->[>]+[->[>]+[->[>]+[<]+<]+<]+<]
If I'm not mistaken, that's a correct translation of the following program in the BF-variant language that uses a single bit for each memory cell (i.e., cell content 0..1 instead of 0..255, so '+' acts to simply flip the bit-value):
>+>+>+>+[+>[>]+[+>[>]+[+>[>]+[<]+<]+<]+<]
The exact value (the number of adjacent 1-bits) produced by the latter program is
3 * (2 ↑ 118842243771396506390315925503 - 1) + 1.
The above program initializes & computes a function that grows like 2↑↑x (in
Knuth up-arrow notation). Similar conversion of a variant-BF program that initializes & computes a function that grows like 2↑
23x provides the following 256-character program:
>+>+>+>+>+>+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[->[>]+[<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+<]+
which eventually halts, leaving more than 2↑236 adjacent cells set equal to 1 (so the number of steps is enormously more than that).
NB-1: 2↑236 is an "inconceivably large" number; e.g., even 2↑46 = 2↑↑↑↑6 already surpasses the first term (3↑↑↑↑3) in the sequence used to compute Graham's number.
NB-2: I think it's likely that 256 characters is enough for a BF program to initialize & compute a function with output much larger than Graham's number — if I find time, maybe I'll try to write one.
NB-3: In case anyone is interested in the origin of the above programs, here are some programming resources for "Brainf*ck F", with various programs written in Python. ("Brainf*ck F", or just "F", is what I called a Turing-complete variant of the Smallf*ck esolanguage.) I just now uploaded these files, which have been offline for several years, and for now the linked webpage is just a "file cabinet" -- see the file Busy_Beavers.txt for a detailed discussion relevant to the above programs.
6I would be surprised if the winner terminates without overflowing the interpreter's count. Bear in mind that the 6-state TM busy beaver takes at least 10**36534 steps. – Peter Taylor – 2012-02-01T22:54:38.980
I agree. Seems highly likely you could write a <50 char BF program that could run for years. I'll get started. – captncraig – 2012-02-01T23:17:29.580
Signed. The Busy Beaver research page at http://www.drb.insel.de/~heiner/BB/ is very interesting, especially the fact that the record programs run extremely long and they still have exact results (see http://www.drb.insel.de/~heiner/BB/bb-xlist.txt) - simulations remember states, build "macros" to save simulation steps etc.
– schnaader – 2012-02-01T23:28:34.843@PeterTaylor: Fortunately, in Python, integers convert to some bignum type when they overflow. :) – Anton Golov – 2012-02-02T00:22:00.867
4@AntonGolov: unfortunately, in this universe, RAMs and HDs don't convert to infinite storage devices when you try to store bignums larger than 256 ^ size in bytes on them... – ceased to turn counterclockwis – 2012-02-02T14:06:22.343
@leftaroundabout: Joking aside, I am looking for a way to determine the number of steps taken by the solutions automatically. I know about the halting problem and all, but I'm wondering if I could boil it down to a multiplication and then take the sum of the logarithms of the coefficients. – Anton Golov – 2012-02-02T15:23:03.813
@AntonGolov: For some programs, yes, you can do that. However... write a program that looks for zeros of the Riemann zeta function. Find a zero, and halt. Otherwise continue searching. Figure out when that halts, and you'll get a million dollars (and piss off a bunch of mathematicians who believe RH). – boothby – 2012-02-03T16:53:28.513
Hmm... sorry, I'm a tard. The above suggests computation with transcendentals, which is not doable with our piddly computers. – boothby – 2012-02-04T22:55:32.323
1@boothby Its perfectly possible to do exact computations involving transcendentals on current computers. The components of the values just have to be stored in a more abstract representation than the normal
float
ordouble
primitives used for general everyday computing. (At that point the computer is mostly just manipulating strings of that represent the equation) – AJMansfield – 2013-07-12T13:17:21.313