(49g 50g) Partition Numbers, Q Partition numbers
|
09-25-2018, 08:36 PM
(This post was last modified: 07-20-2023 12:02 PM by John Keith.)
Post: #1
|
|||
|
|||
(49g 50g) Partition Numbers, Q Partition numbers
Edited to replace second program with smaller and faster version, and to add program for Q partitions.
Edited again 07/20/2023 with improved second and third programs. Given an integer n on the stack, the first two programs return a list of the partition numbers (A000041) from 0 through n. The first program is small, and the second one is fast. The following program is based on a summation involving the divisor sigma function (sum of divisors of an integer) shown here. It uses Gerald Hillier's SUMDIVISORS program from hpcalc.org. It also requires ListExt, and must be run in exact mode. Code:
The next program uses a recurrence based on Euler's Pentagonal Number Theorem, as shown here. The first part of the program is devoted to generating a list of generalized pentagonal numbers. This program requires ListExt and should be run in exact mode to give exact results for larger values of n. Code:
The second program is 2 to 6 times as fast as the first depending on list size. This next program returns a list of Q partitions ( A000009) which are the number of partitions into distinct parts, or odd parts. See here for description. Edit: this program is semi-obsolete for the HP 49 and 50. See post #3 below. Code:
This program is essentially the same as the second program except for the IF...THEN...ELSE structure at the end. The two can easily be combined into one program if desired. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(49g 50g) Partition Numbers, Q Partition numbers - John Keith - 09-25-2018 08:36 PM
RE: (49g 50g) Partition Numbers, Q Partition numbers - John Keith - 08-27-2019, 01:02 PM
RE: (49g 50g) Partition Numbers, Q Partition numbers - John Keith - 07-20-2023, 11:59 AM
|
User(s) browsing this thread: 4 Guest(s)