Post Reply 
(49G) Number of Integer Partitions in Squares
07-29-2015, 10:15 AM (This post was last modified: 06-15-2017 01:44 PM by Gene.)
Post: #1
(49G) Number of Integer Partitions in Squares
For integer input the programme returns the number of integer partitions in squares.

eg For input

7

the programme returns

2

& indeed

7 = 1 + 1 + 1 + 1 + 1 + 1 + 1

&

7 = 4 + 1 + 1 + 1

& these are the only two partitions purely in squares.

Similarly, for input

100

the programme returns

1,116

For more info see

http://oeis.org/A001156

Code:

::
  CK1&Dispatch
  BINT1
  ::
    %ABSCOERCE
    BINT1
    BINT3
    '
    ::
      DEPTH
      #>$
      BIGDISPROW3
      3PICK3PICK
      #<case
      ::
        2DROP
        #0=case
        BINT1
        BINT0
      ;
      3PICK3PICK
      #-
      3PICK3PICK
      1GETLAM
      EVAL
      4UNROLL
      DUPUNROT
      #+SWAP
      #2+
      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: 1 Guest(s)