Post Reply 
(49G) A Fibonacci-like Sequence with Only Composite Members
07-09-2015, 05:10 PM (This post was last modified: 06-15-2017 01:47 PM by Gene.)
Post: #1
(49G) A Fibonacci-like Sequence with Only Composite Members
A programme to produce a Fibonacci-like sequence but starting with zeroth element

106276436867

& first element

35256392432

the following numbers being the sum of the preceding two elements of the series.

Interestingly, every element of the series is a composite number.

Input an integer N to find the Nth sequence element.
Code:

::
  CK1&Dispatch
  BINT1
  ::
    %ABSCOERCE
    ZINT 106276436867
    SWAP
    DUP#0=csDROP
    ZINT 35256392432
    SWAPDUP
    #1=case
    DROPSWAPDROP
    FPTR2 ^#>Z
    ::
      DUP
      Z2_
      Z<
      case
      ::
        BINT4
        NDUPN
        DROP
      ;
      FPTR2 ^Z>ZH
      Z-2_
      Z0Z1_
      4PICK
      FPTR2 ^ZBits
      SWAPDROP#1-_
      ZERO_DO
      FPTR2 ^ZSQ_
      SWAP
      FPTR2 ^ZSQ_
      2DUP
      FPTR2 ^RSUBext
      DUP
      FPTR2 ^RADDext
      3PICK
      FPTR2 ^RADDext
      3UNROLL
      FPTR2 ^RADDext
      SWAPROT
      FPTR2 ^RADDext
      3PICK
      ISTOP-INDEX
      #1-
      FPTR2 ^ZBit?
      SWAPDROP
      ITE
      ::
        DUPUNROT
        FPTR2 ^QAdd
        Z-2_
      ;
      Z2_
      3UNROLL
      LOOP
    ;
    2SWAP
    2DROP
    ROT
    FPTR2 ^RMULText
    3UNROLL
    FPTR2 ^RMULText
    FPTR2 ^RADDext
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




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