1{?)=}&~".>")!@(</=+={"/>}*
展開:
1 { ? )
= } & ~ "
. > " ) ! @
( < / = + = {
" / > } * .
. . . . .
. . . .
オンラインでお試しください!
説明
シーケンスb(a) = a(n) - 1
を検討して、少し並べ替えてみましょう。
b(a) = a(n) - 1
= a(n-1)*(a(n-1)-1) + 1 - 1
= (b(n-1) + 1)*(b(n-1) + 1 - 1)
= (b(n-1) + 1)*b(n-1)
= b(n-1)^2 + b(n-1)
このシーケンスは非常に似ていますが、増分を最後まで延期することができます。これにより、このプログラムでバイトが保存されます。
注釈付きのソースコードは次のとおりです。

TimwiのHexagonyColorerで作成されました。
そして、これはメモリダイアグラムです(赤い三角形はメモリポインタの初期位置と方向を示しています)。

TimwiのEsotericIDEで作成。
コードは、左隅を囲む灰色のパスから始まるため、最初の線形ビットは次のようになります。
1{?)(
1 Set edge b(1) to 1.
{ Move MP to edge N.
? Read input into edge N.
)( Increment, decrement (no-op).
次に、コード<
はブランチにヒットし、メインループの開始(および終了)を示します。Nエッジに正の値がある限り、緑のパスが実行されます。そのパスはグリッドを数回ラップしますが、実際には完全に線形です:
""~&}=.*}=+={....(
.
ノーオペレーションではないので、実際のコードです。
""~&}=*}=+={(
"" Move the MP to edge "copy".
~ Negate. This is to ensure that the value is negative so that &...
& ...copies the left-hand neighbour, i.e. b(i).
}= Move the MP to edge b(i)^2 and turn it around.
* Multiply the two copies of b(i) to compute b(i)^2.
}= Move the MP back to edge b(i) and turn it around.
+ Add the values in edges "copy" and b(i)^2 to compute
b(i) + b(i)^2 = b(i+1).
={ Turn the memory pointer around and move to edge N.
( Decrement.
このデクリメントがに減少N
する0
と、赤いパスが実行されます。
")!@
" Move MP back to edge b(i) (which now holds b(N)).
) Increment to get a(N).
! Print as integer.
@ Terminate the program.