Post Reply 
(49G) Gould's Sequence OEIS A001316
09-02-2015, 07:43 AM (This post was last modified: 06-15-2017 01:45 PM by Gene.)
Post: #1
(49G) Gould's Sequence OEIS A001316
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.

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#
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)