Post Reply 
(49G) Moser de Bruijn Sequence, OEIS A000695
10-30-2015, 05:36 PM (This post was last modified: 06-15-2017 01:45 PM by Gene.)
Post: #1
(49G) Moser de Bruijn Sequence, OEIS A000695
For integer input N the programme returns the Nth element of the sequence

http://oeis.org/A000695

ie the binary base representation of N read as a quaternary base number.

Code:

::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^DupQIsZero?
    ?SEMI
    Z0_
    SWAP
    FPTR2 ^Z>ZH
    FPTR2 ^ZBits
    ZERO_DO
    SWAP
    Z4_
    FPTR2 ^RMULText
    SWAP
    ISTOP-INDEX
    #1-
    FPTR2 ^ZBit?
    IT
    ::
      SWAP
      Z1_
      FPTR2 ^RADDext
      SWAP
    ;
    LOOP
    DROP
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




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