HP Forums
(49G) Number of Integer Partitions in Squares - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (49G) Number of Integer Partitions in Squares (/thread-4449.html)



(49G) Number of Integer Partitions in Squares - Gerald H - 07-29-2015 10:15 AM

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
  ;
;