09-02-2015, 07:43 AM
Gould's sequence
http://oeis.org/A001316
counts the number of odd terms in the rows of Pascal's triangle.
For integer input the programme returns the number of odd occurences in that line of Pascal's triangle, starting with line zero.
http://oeis.org/A001316
counts the number of odd terms in the rows of Pascal's triangle.
For integer input the programme returns the number of odd occurences in that line of Pascal's triangle, starting with line zero.
Code:
::
CK1&Dispatch
# FF
::
FPTR2 ^DupQIsZero?
casedrop
Z1_
ZEROSWAP
FPTR2 ^Z>ZH
FPTR2 ^ZBits
ZERO_DO
INDEX@
FPTR2 ^ZBit?
IT
SWAP#1+SWAP
LOOP
DROP
Z2_
SWAP
FPTR2 ^RP#
;
;