HP Forums

Full Version: (49G) Number of Integer Partitions in Squares
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
  ;
;
Reference URL's