Zeckendorf number representation: Difference between revisions

(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
Line 4,095:
20 101010
</pre>
 
=={{header|RPL}}==
The two-step algorithm - first generating a series a Fibonacci numbers, then encrypting - is an opportunity to showcase the structured programming that RPL allows, with two separate structures having each their own local variables to avoid too complex stack handlings.
{{works with|Halcyon Calc|4.2.7}}
≪ → m
≪ { 1 } 1 1
DO
ROT OVER SWAP +
ROT ROT SWAP OVER +
UNTIL DUP m > END
DROP2 m SWAP
→ fibs
≪ "" SWAP
1 fibs SIZE 1 - FOR j
fibs j GET
IF DUP2 ≥ THEN - SWAP "1" ELSE DROP SWAP "0" END
+ SWAP
NEXT
DROP
'→ZKDF' STO
≪ { } 1 20 FOR j j →ZKDF + NEXT ≫ EVAL
{{out}}
<pre>
{ "1" "10" "100" "101" "1000" "1001" "1010" "10000" "10001" "10010" "10100" "10101" "100000" "100001" "100010" "100100" "100101" "101000" "101001" "101010" }
</pre>
 
 
=={{header|Ruby}}==
1,150

edits