(38G) Number of Integer Partitions in Distinct Parts (after Gauss)

03132015, 02:29 PM
(This post was last modified: 06152017 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: I1►K: 0►A: 0►S: WHILE K>0 REPEAT A*V+L2(K)►A: FLOOR(2^V*H+1)►H: V►V: KH►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("N1"):": 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! 

« Next Oldest  Next Newest »

Messages In This Thread 
(38G) Number of Integer Partitions in Distinct Parts (after Gauss)  Gerald H  03132015 02:29 PM
RE: HP 38G: Distinct Parts, Number of Integer Partitions (Improved Programme)  Gerald H  03282015, 05:39 AM

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