Post Reply 
(49g 50g) Partition Numbers, Q Partition numbers
08-27-2019, 01:02 PM
Post: #2
RE: (49g 50g) Partition Numbers, Q Partition numbers
Next, a program that returns the partition number triangle, A008284, as a list of lists. It is large (214 bytes) but fast, as it takes advantage of many patterns that occur in the triangle.

HP-48G compatible if the commands I->R and R->I are removed and PICK3 changed to 3 PICK.

Code:

\<< I\->R \-> n
  \<< { 1 } DUP 1 + DUP 1 + 4. n
    FOR k { 1 } k 2. / IP R\->I +
      IF k 5. >
      THEN 3. DUP k 6. - 2. / IP +
        FOR j j 1. + PICK j GET PICK3 j 1. - GET + +
        NEXT
      END OVER k 2. / IP k SUB +
    NEXT n \->LIST
  \>>
\>>

Partial sums of rows are A026820, the partition of n into at most k parts. These are the numbers returned by Gerald Hillier's program here.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (49g 50g) Partition Numbers, Q Partition numbers - John Keith - 08-27-2019 01:02 PM



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