Leonardo numbers: Difference between revisions

No edit summary
(→‎{{header|RPL}}: one-liner)
Line 2,145:
'''NEXT''' DROP2
'''END'''
≫ ≫ ''''LENDO'''' STO
|
''( L(0) L(1) add n -- { L(0) .. L(n-1) } )''
Line 2,158:
|}
{{in}}
The following instructions will deliver what is required:
<pre>
1 1 1 25 LENDO
01 1 01 25 '''LENDO'''
10 1 10 25 '''LENDO'''
</pre>
{{out}}
<pre>
Line 2,166 ⟶ 2,168:
1: { 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 }
</pre>
===One-liner===
≪ → l0 l1 add n ≪ l0 l1 2 n '''START''' DUP2 + add + '''NEXT''' n 1 + →LIST ≫ ≫ ''''LEONE'''' STO
{{in}}
<pre>
1,1,1,24 '''LEONE'''
0,1,0,24 '''LEONE'''
</pre>
Same output as above.
 
=={{header|Ruby}}==
1,150

edits