Post Reply 
(38G) Number of Integer Partitions in Distinct Parts (after Gauss)
03-13-2015, 02:29 PM (This post was last modified: 06-15-2017 01:57 PM by Gene.)
Post: #1
(38G) Number of Integer Partitions in Distinct Parts (after Gauss)
Edit: Improved programme

For Ans a positive integer the programme finds the number of partitions into distinct integer parts:

Ans+1►N:
MAKELIST(1,X,1,N,1)►L2:
1►T:
1►R:
3►U:
FOR I=2 TO N STEP 1;
1►H:
-1►V:
I-1►K:
0►A:
0►S:
WHILE K>0
REPEAT
A*V+L2(K)►A:
FLOOR(2^V*H+1)►H:
-V►V:
K-H►K:
END:
IF I==U
THEN
(-1)^(R MOD 2)►S:
NOT(T)►T:
U+2*R+T*(2*R+2)►U:
R+T►R:
END:
ABS(A)+S►L2(I):
END:
ERASE:
DISP 2;" q("N-1"):":
DISP 4;" "L2(N):
DISP 6;"Exact to N = 331":
BEEP 1953;.18:
FREEZE:

For Ans = 20 the programme returns:

q(20)

64

Exact to N = 331.

Where N is the Ans from the HOME view.

Happily the number of partitions into distinct parts is the same as that into odd parts - two for the price of one!
Find all posts by this user
Quote this message in a reply
03-28-2015, 05:39 AM
Post: #2
RE: HP 38G: Distinct Parts, Number of Integer Partitions (Improved Programme)
Edit: Improved programme.
Find all posts by this user
Quote this message in a reply
Post Reply 




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