Zeckendorf number representation: Difference between revisions

→‎{{header|Quackery}}: now works with any non-negative integer, not just task requirement
(→‎{{header|Quackery}}: removed the off-task code)
(→‎{{header|Quackery}}: now works with any non-negative integer, not just task requirement)
Line 3,618:
=={{header|Quackery}}==
 
<lang Quackery>[ ' [ 2 1base ]put
[ dup 0 peek echo
base release ] is binecho ( n --> )
over 1 peek +
rot 2dup < while
unrot
swap join again ]
2drop ] is obif ( n --> [ )
 
[ 0 swap ' [ 2 1 ]
[ 20 obif ] constant is fibnums ( --> [ )
[ 2dup 0 peek < iff
else [ behead drop ]
[ -done
[ i^ dup 0 peek
over 1 peek +
+ swap join again ]
fibnums witheach witheach
[ rot 1 << unrot
rot 2dup < whileiff drop
else
dip [ 1 | ] ]-
dip
[ 1 | ] ] ]
2drop ] drop ] is obif is n->z ( n --> [z )
 
[ 0 swap21 times
[ i^ dup 10 < if sp
fibnums witheach
[ rot 1dup <<echo unrotsp
2dupn->z <binecho notcr iff]</lang>
[ -
dip [ 1 | ] ]
else drop ]
drop ] is zeckendorficate ( n --> n )
 
[ 2 base put
echo
base release ] is binecho ( n --> )
 
21 times
[ i^ dup
dup 10 < if sp
echo sp
zeckendorficate binecho
cr ]</lang>
 
{{Out}}
 
<pre> 10 10
1 1
2 10
3 100
Line 3,669 ⟶ 3,665:
18 101000
19 101001
20 101010</pre>
</pre>
 
=={{header|R}}==
1,462

edits