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yh-yt0nvMs%'6\;$%(91gTC=&1q]q-*u*so KrXsE
-Sz>q]l86[OO@\5W<'\XDc,%/=0sV0&1'Etty%f ~,c45IIqy=no.DY{8\?fa<9{
S`T} 7Tn9!h8P\W 8J\#Mg\o;Qwt&4\UYKf{)O3G&B]sK.bw1!?7=:h$IIOIakD<
H/O5v`ld*35MSsydSQoiAnJ*\!^?'_=6E?c> PtM!rw5y{ZT2xSco){3_?j|wtJp
OP[kT<l@cKB="n;VC#6a*InmS~$TN{= j)r>S] uH9:E-}y>.Ygc'll$5Y$j]AYt
_(myN5'%] C!7FPoGX7+*,Yptuaz;Q6W,;R|U1XEhgq21R7<ncnDB<D_);j.:r0r
nf+yZ`7P-(@{>s:{Vz'N 7qB&+UZbm4'0]D~HZNJq.w</3 \cL)WRDP(y]w~L4N/
2s}1@?{0);Jo6(J@l>[M 0CkeO6{ExN7,%Kv1#[!** czaX)=;Q~D;z',fkq!1W<
% f(i#i`PQY!m7v#D:j5pyU]8:at2,k("BWZRI<WR??GQ$^1d[m,F(<e5CLv-m*B
CD)zVpa95WpJ K@&}yN\Q8I<%z/*_/bPsR5=0\Z=#mWZDAfA5[k|$Yks@Q;@h,s/
EMg$>kD|\ ^.W)Stzv/7z\^bdi]E@] U&-r8(B^?}$P56[?e~jE#_j)5=#~.yNP$
'mgF3EAhXB 55)\WXp*e+fD#^&SHGx++7VO[R7*b(Q+:jESt'K%m~d$Bv^/{7=zr
5oCZDp& ;*Y*G`L$C]Nm`|^:y2NKaO!)u/{hwm(VjS`<qKgNw7[+~0 <be'sWjTo
*rJg/ o;6M7`(qTF.nO'4da,{ieM&NC9rg;nX*))*DK"DycYD66&6z/I@}y4@$<f
3S]~9g An{=Rj|y&A2Vh^F\3lb#N~8w0EMx<K$]z(eZS~zbmgeeV\i7,MY~zrc+;

Your task in this challenge is not to write your own code, but rather to extract code from this block of text as if it is a huge Boggle grid and you're looking for a runnable program instead of a word.

The submission with the program that produces the longest finite output wins.


Treat the 64 by 64 grid of text exactly like a 64 by 64 Boggle grid with additional characters. Construct a string that is a runnable program in some language by choosing a starting location in the grid and repeatedly moving one step vertically, horizontally, or diagonally (8 directions total) as many times as you want. You may NOT use the same grid space more than once!

For example, these 4 lines were taken from near the middle of the text block:

EJzH \gwosC>Z*)H!]1BPaIEYGyk{c0zv{d\#px2@#'-T{{.Qxknxv}"x3#K]w>;
<X(\bNnY_6*7Yu7_3a+wInwt vh=1eBgz>7Bnhs!<t.T#&V{+?p+{.RTN:xz>|,E
$upN*[F4A`~ZDMDt{.&2z+LZ7bcfeJfF9Uy3xX]ZzQ1FvB.U4S!hm$LYCp: wF7h
 47-+lY$"}AExXQ@?!/6}biptH=6N-6&8-T\C8{`i56e'%cimv,0QKYTx) "nkFJ

Starting with the p near the right end of the third line I can move to the by going diagonally down and right, then to the " by going right, then up 3 times over  zK, and left 4 times over #3x". This traces out the string p " zK#3x" which when run as a Ruby program outputs " zK#3x".

The goal is to find a program that produces the longest finite output. Only printable ASCII characters are considered when counting the length of the output (this means tabs and newlines are not counted), though other characters may be present. The Ruby example only produces 8 characters.


  • The program may be from 1 to 4096 characters long.
  • The program may not contain tabs, newlines, or non-printable ASCII (as they aren't in the grid).
  • The program should run and exit without errors.
  • There are no time or complexity constraints as long as the program would eventually terminate with finite output.
  • The grid does not loop around from left to right or top to bottom.

Please mention where your program appears in the grid so we can quickly verify that it really is there.

  • 8
    \$\begingroup\$ Why the 4096 character rest... oh. \$\endgroup\$ Jan 16, 2015 at 10:04
  • 2
    \$\begingroup\$ Maybe it would have been more interesting if the program had to solve an actual code golf problem, but be taken from the grid. \$\endgroup\$
    – feersum
    Jan 16, 2015 at 11:47
  • 2
    \$\begingroup\$ @DavidCarraher - Or for any non-golfing language actually. I found one instance of yes, for example. \$\endgroup\$
    – user15259
    Jan 16, 2015 at 15:48
  • 1
    \$\begingroup\$ TECO is not a golfing language...it is a tape/text editor dating from the 1960s. \$\endgroup\$
    – feersum
    Jan 16, 2015 at 23:06
  • 1
    \$\begingroup\$ Looks like perfectly viable perl program at first glance... \$\endgroup\$
    – DGM
    Jan 17, 2015 at 0:48

3 Answers 3


CJam, over (81182737^2813292)↑↑(10604499373-1) chars

Okay I think I've finally sorted everything out. This was fun — coming up with the code was like navigating a minefield.

Before we dive in, let's start with a simpler example (try it online):

1 3{(\1\{(\5*\}h;\}h;

h is a do-while loop that leaves the condition on the stack, and {} are code blocks. The inner block is:

(        Decrement
\        Swap top two of stack
5*       Push 5 and multiply
\        Swap back

Suppose the top of the stack is [1 10] and we perform the do-while {(\5*\}h;. This is what happens:

[1 10] --decrement--> [1 9]    --swap--> [9 1]    --multiply--> [9 5^1]  --swap--> [5^1 9]
       --decrement--> [5^1 8]  --swap--> [8 5^1]  --multiply--> [8 5^2]  --swap--> [5^2 8]
       --decrement--> [5^2 7]  --swap--> [7 5^2]  --multiply--> [7 5^3]  --swap--> [5^3 7]

This happens until the 10 decrements all the way down to 0 and the loop terminates, at which point we end up with [5^10 0] at the top of the stack. We can then use ; to pop the zero, leaving [5^10].

In other words we have just performed exponentiation, with [1 x]{(\5*\}h; resulting in [5^x].

The outer block {(\1\{(\5*\}h;\}h; is similar, but instead of the 5* in the middle we have our "exponentiate base 5" loop. So for our simple example, starting with [1 3] we get:

[1 3] -dec/swap-> [2 1]   -push 1-> [2 1 1]   -swap-> [2 1 1]   -5^-> [2 5]     -swap-> [5 2]
      -dec/swap-> [1 5]   -push 1-> [1 5 1]   -swap-> [1 1 5]   -5^-> [1 5^5]   -swap-> [5^5 1]
      -dec/swap-> [0 5^5] -push 1-> [0 5^5 1] -swap-> [0 1 5^5] -5^-> [0 5^5^5] -swap-> [5^5^5 0]

The top is zero, so we stop the loop and pop, leaving [5^5^5]. In other words, we have just created 5^5^5, or 5↑↑3 in Knuth's up arrow notation. You can switch 5 and 3 for other numbers but hyperexponentiation gets big fast, so I wouldn't recommend picking anything too large.

Now for the real thing:

1B);0D+9#{z(J Y=A*;\VC#UooJ87<W5^o\OO>;J6%_9=+NpXzH|>!p{Kdp(_E=XIK21^%^Z&&p\Y~!E<432|T|Z#00I0*boW)I^8227(*JEo*#09;*7XH+G^o9=pWdK>(2P-*I\6539K~>)#D@</CJ1(+^po\F"U$(jX?a"apV\|;}_V);;D00&phVA^^6pJP\<%o\8H>V1^+aoXY-Y&41-X)8/o!Jb;}"}:rM)<W?o:p'";h

(Path trace)

Anotated (anything without notes is filler):

1                                           Push 1
0D+9#                                       Push 13^9 = 10604499373
{                                           Start outer block
(                                           Decrement
J Y=A*;
\                                           Swap
J87<                                        Push 1
\                                           Swap back
{                                           Start inner block
(                                           Decrement
\                                           Swap
Y~!E<432|T|Z#00I0*boW)I^8227(*JEo*#         Push 81182737^2813292, <output 3 chars>
*                                           Multiply by previous large number
\                                           Swap back
}                                           End inner block
h                                           Perform inner do-while loop
VA^^6pJP\<%o                                Pop top of stack by outputting
\                                           Swap back
}                                           End outer block
h                                           Perform outer do-while loop

It's basically the same as the simple example, just with a lot of filler while navigating from one instruction to another in the grid.

Instead of 5 and 3 we have 81182737^2813292 and 10604499373, meaning that (81182737^2813292)↑↑10604499373 gets outputted at the end (given enough time and memory, of course!). Note that this is merely a lower bound — there's a lot of other printing that takes place, e.g. with 6 and 3 the output is over 2 million chars long even though 6^6^6 has only 36k digits.

If you want to try this full version for yourself, test with:

{z(J Y=A*;\VC#UooJ87<W5^o\OO>;J6%_9=+NpXzH|>!p{Kdp(_E=XIK21^%^Z&&p\

replacing the 5 and 3 on the second and fourth lines with numbers of your choice. Note that the output will have a few extra digits around the important hyperexponentiated number (namely a preceding 010 and a trailing 0).

A few notes on CJam

You might we wondering: why not use CJam's inbuilt exponentiation (#) instead of the inner do-while loop? Unfortunately, after digging through CJam's source, I learnt that for exponentiation the base can be a BigInt (arbitrary precision) but the exponent gets converted to a normal 32-bit int. This has some amusing, but annoying side effects:

2 2 31# #     -->    java.lang.ArithmeticException: Negative exponent  (should be 2^2^31)
2 2 32# #     -->    1                                                 (should be 2^2^32)

This meant that I couldn't use CJam's builtin exponentation when the exponent is too large, for overflow reasons. However, multiplication is different as multiplying two BigInts results in a new BigInt, so I decided to exploit that instead.

  • 4
    \$\begingroup\$ Minute rule removed. Go crazy! \$\endgroup\$ Jan 16, 2015 at 11:06

TECO, ~2^31 * 13 ~= 27.9 * 10^9


enter image description here

Edit: Changed a couple of characters because I accidentally reused one, but that part was inside a comment so it doesn't make much difference.

The ? turns on command echoing, which I use to create most of the output. Then the characters \RZK%B"s'1UC> are printed in a loop. %B"s adds one to B and then tests if it is less than zero. Thus, this conditional should be entered after 2^31 cycles when it overflows to a negative number. Inside the conditional there is an EX command which exits the program.

Currently I am attempting to run it to completion with the output directed to a file.

  • \$\begingroup\$ "Currently I am attempting to run it to completion with the output directed to a file." I hope you have 27.9 GB (26 GiB) of free space, then... \$\endgroup\$ Jan 16, 2015 at 11:20
  • 1
    \$\begingroup\$ @JanDvorak I have over 600 GB of free space... however it is proceeding so slowly it seems somehow unlikely to make it all the way. \$\endgroup\$
    – feersum
    Jan 16, 2015 at 11:21

HQ9+ (17195 characters)



(starts at 5:4 and then down)


The text to the song "99 bottles of beer" (8596 characters), the string 9Q9 (3 characters) and another copy of "99 bottles of beer" (8596 characters).

This is a very lame answer and you should not upvote it, but someone had to post it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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