05-20-2014, 06:01 PM

Edit: More easily readable & faster programme.

The programme's name is P4. Input a positive integer in the Home screen & actuate the programme. For input N = 6 the screen displays:

p(6)

11

Exact to N = 180

Ans+1►N:

MAKELIST(1,X,1,N,1)►L1:

FOR I=2 TO N STEP 1;

1►H:

-1►V:

I-1►K:

0►A:

WHILE K>0

REPEAT

A*V+L1(K)►A:

FLOOR(2^V*H+1)►H:

-V►V:

K-H►K:

END:

ABS(A)►L1(I):

END:

ERASE:

DISP 2;" p("N-1"):":

DISP 4;" "L1(N):

DISP 6;"Exact to N = 180":

BEEP 1953;.18:

FREEZE:

You may find this link:

http://en.wikipedia.org/wiki/Partition_(number_theory)

informative concerning partitions.

The programme's name is P4. Input a positive integer in the Home screen & actuate the programme. For input N = 6 the screen displays:

p(6)

11

Exact to N = 180

Ans+1►N:

MAKELIST(1,X,1,N,1)►L1:

FOR I=2 TO N STEP 1;

1►H:

-1►V:

I-1►K:

0►A:

WHILE K>0

REPEAT

A*V+L1(K)►A:

FLOOR(2^V*H+1)►H:

-V►V:

K-H►K:

END:

ABS(A)►L1(I):

END:

ERASE:

DISP 2;" p("N-1"):":

DISP 4;" "L1(N):

DISP 6;"Exact to N = 180":

BEEP 1953;.18:

FREEZE:

You may find this link:

http://en.wikipedia.org/wiki/Partition_(number_theory)

informative concerning partitions.