Post Reply 
(50G)Integer Partitions in Fibonacci Numbers
08-12-2015, 02:34 PM (This post was last modified: 06-15-2017 01:40 PM by Gene.)
Post: #1
(50G)Integer Partitions in Fibonacci Numbers
The total number of partitions of

7

is

15

of which

10

are composed purely of Fibonacci numbers &

1

is composed of distinct Fibonacci numbers.

{ [ 7 ] [ 6 1 ] [ 5 2 ] [ 5 1 1 ] [ 4 3 ] [ 4 2 1 ] [ 4 1 1 1 ] [ 3 3 1 ] [ 3 2 2 ] [ 3 2 1 1 ] [ 3 1 1 1 1 ] [ 2 2 2 1 ] [ 2 2 1 1 1 ] [ 2 1 1 1 1 1 ] [ 1 1 1 1 1 1 1 ] }

The programme PINFIBS returns for integer input the number of partitions in Fibonacci numbers.

Code:

PINFIBS

::
  CK1&Dispatch
  BINT1
  ::
    "       # PARTITIONS IN FIBOS"
    DispCoord1
    SetDA3Temp
    %ABSCOERCE
    ONEONE
    '
    ::
      3PICK3PICK
      #<
      case2drop
      ::
        #0=case
        BINT1
        BINT0
      ;
      3PICK3PICK
      #-
      3PICK3PICK
      1GETLAM
      EVAL
      4UNROLL
      OVER
      #+SWAP
      1GETLAM
      EVAL
      #+
    ;
    DUP1LAMBIND
    EVAL
    ABND
    FPTR2 ^#>Z
  ;
;

The programme PINDFIBS returns for integer input the number of partitions in distinct Fibonacci numbers.

Code:

PINDFIBS

::
  CK1&Dispatch
  BINT1
  ::
    "  # PARTITIONS IN DISTINCT FIBOS"
    DispCoord1
    SetDA3Temp
    %ABSCOERCE
    ONEONE
    '
    ::
      3PICK3PICK
      #<
      case2drop
      ::
        #0=case
        BINT1
        BINT0
      ;
      3PICK3PICK
      #-
      3PICK3PICK
      OVER
      #+SWAP
      1GETLAM
      EVAL
      4UNROLL
      OVER
      #+SWAP
      1GETLAM
      EVAL
      #+
    ;
    DUP1LAMBIND
    EVAL
    ABND
    FPTR2 ^#>Z
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




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