03-19-2015, 07:33 AM
For positive integer input N the programme returns the Nth element of the series
http://oeis.org/A002487
::
CK1&Dispatch
# FF
::
FPTR2 ^DupQIsZero?
?SEMI
Z0_
Z1_
ROT
FPTR2 ^Z>ZH
FPTR2 ^ZBits
ZERO_DO
INDEX@
FPTR2 ^ZBit?
ITE
::
ROT
3PICK
FPTR2 ^QAdd
3UNROLL
;
::
SWAP3PICK
FPTR2 ^QAdd
SWAP
;
LOOP
2DROP
;
;
http://oeis.org/A002487
::
CK1&Dispatch
# FF
::
FPTR2 ^DupQIsZero?
?SEMI
Z0_
Z1_
ROT
FPTR2 ^Z>ZH
FPTR2 ^ZBits
ZERO_DO
INDEX@
FPTR2 ^ZBit?
ITE
::
ROT
3PICK
FPTR2 ^QAdd
3UNROLL
;
::
SWAP3PICK
FPTR2 ^QAdd
SWAP
;
LOOP
2DROP
;
;