(40gs) /G, 39gs/G & 38G: Partition Programme
10-08-2016, 07:07 AM (This post was last modified: 06-15-2017 01:53 PM by Gene.)
Post: #1
 Gerald H Senior Member Posts: 1,430 Joined: May 2014
(40gs) /G, 39gs/G & 38G: Partition Programme
Enter positive integer N in the HOME screen then activate programme P5 - the number of integer partitions of N is returned in Ans in the HOME screen.

For info on partitions see

http://mathworld.wolfram.com/Partition.html

Code:
 P5 INT(Ans)►N: IF N<1 THEN 0: ELSE 0►B: √(2/3)►H: 1►C: N-1/24►F: √F►R: RHπ►G: πH/F►H: FR►F: 2π►P: 2N►Q: DO 0: FOR D=1 TO C STEP 1; IF GCD(C,D)==1   #For 39gs/G & 38G replace this line with snippet below this programme. THEN COS(π*(Σ(I=1,C-1, (FRAC(DI/C)-.5)*(I/C-.5))+.25-QD/C))+Ans:  END: END: Ans►E: G/C: (COSH(Ans)H/C-SINH(Ans)/F)√C/P►O: C+1►C: OE+B►B:  ROUND(O+B,0): UNTIL Ans==ROUND(B,0) END:  END: ERASE: Replacement snippet for 39G/gs & 38G C►I: D►J: DO I MOD J►K: J►I: K►J: UNTIL NOT K END: IF I==1
 « Next Oldest | Next Newest »

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