(38G) Number of Integer Partitions in Distinct Parts (after Gauss) - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Software Libraries ( /forum-10.html)+--- Forum: General Software Library ( /forum-13.html)+--- Thread: (38G) Number of Integer Partitions in Distinct Parts (after Gauss) ( /thread-3356.html) |

(38G) Number of Integer Partitions in Distinct Parts (after Gauss) - Gerald H - 03-13-2015 02:29 PM
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! RE: HP 38G: Distinct Parts, Number of Integer Partitions (Improved Programme) - Gerald H - 03-28-2015 05:39 AM
Edit: Improved programme. |