Post Reply 
(50G) Champernowne Sequence (OEIS A030190)
01-08-2017, 09:35 AM (This post was last modified: 06-15-2017 01:43 PM by Gene.)
Post: #1
(50G) Champernowne Sequence (OEIS A030190)
The Champernowne sequence

https://oeis.org/A030190

is the natural number sequence

https://en.wikipedia.org/wiki/ISO_80000-2

concatenated in binary & split into single digits:

0,1,1,0,1,1,1,0,0.........

For integer input N the programme returns the Nth element of the series starting from index zero.


Code:

::
  CK1&Dispatch
  BINT1
  ::
    FPTR2 ^PUSHFLAGS_
    %ABSCOERCE
    #1+
    DOBIN
    BINT64
    dostws
    BINT0
    BEGIN
    DUP
    #>HXS
    hxs>$
    LEN$
    #2-
    ROTSWAP
    2DUP
    #-
    4UNROLL
    DIFF_OR_ZERO_
    #0<>
    WHILE
    #1+
    REPEAT
    #>HXS
    hxs>$
    BINT3
    LAST$
    DUPLEN$
    FPTR2 ^POPFLAGS_
    ROTSWAP
    2DUP#>
    IT
    ::
      BINT0
      ROT
      #-SWAP
    ;
    SWAP#-
    DUP
    SUB$
    FPTR2 ^S>Z
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(50G) Champernowne Sequence (OEIS A030190) - Gerald H - 01-08-2017 09:35 AM



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