Post Reply 
WP 34S Partition of Integers Programme & a Possible OS Bug
05-08-2014, 10:53 AM
Post: #1
WP 34S Partition of Integers Programme & a Possible OS Bug
The programme PRT returns the number of integer partitions on stack level X for the input integer on stack level X; QRT similarly returns the number of partitions into distinct parts.

1 LBL 'PRT'
2 CF 01
3 SKIP 002
4 LBL 'QRT'
5 SF 01
6 DECM
7 DBLON
8 RAD
9 STO 00
10 # 024
11 1/X
12 FC? 01
13 +/-
14 +
15 STO 06
16 FS? 01
17 SKIP 011
18 √
19 1
20 .
21 5
22 1/X
23 √
24 STO 08
25 *
26 # π
27 *
28 STO 07
29 CLx
30 STO 01
31 1
32 STO 02
33 FIX 00
34 RCL 02
35 STO 03
36 CLx
37 STO 04
38 RCL 02
39 RCL 03
40 GCD
41 x≠1?
42 SKIP 033
43 RCL 02
44 x<>Y
45 -
46 x≠0?
47 SKIP 016
48 STO 05
49 CLx
50 LBL 00
51 RCL 03
52 RCL* 05
53 RCL/ 02
54 FP
55 RCL 05
56 RCL/ 02
57 # 1/2
58 STO- Z
59 -
60 *
61 +
62 DSE 05
63 GTO 00
64 4
65 1/X
66 +
67 RCL 00
68 STO+ X
69 RCL* 03
70 RCL/ 02
71 -
72 # π
73 *
74 COS
75 STO+ 04
76 DSE 03
77 BACK 039
78 FS? 01
79 SKIP 030
80 RCL 07
81 RCL/ 02
82 e^x
83 ENTER
84 ENTER
85 1/X
86 STO- Z
87 +
88 RCL* 08
89 RCL 06
90 STO/ Z
91 /
92 # π
93 *
94 RCL/ 02
95 x<>Y
96 RCL 06
97 √
98 /
99 -
100 RCL 02
101 √
102 *
103 # π
104 4
105 *
106 /
107 ENTER
108 INC 02
109 SKIP 035
110 RCL 06
111 # π
112 RCL/ 02
113 x^2
114 *
115 # 012
116 /
117 STO 03
118 CLx
119 1
120 ENTER
121 STO 05
122 ENTER
123 x<>Z
124 RCL* 03
125 RCL 05
126 STO/ Y
127 1
128 +
129 STO 05
130 /
131 STO+ Y
132 x<>Z
133 x≠? Y
134 BACK 011
135 # π
136 RCL/ 02
137 x^2
138 *
139 2
140 STO+ 02
141 6
142 *
143 /
144 STO Y
145 RCL* 04
146 RCL+ 01
147 STO 01
148 STO+ Y
149 ROUND
150 x<>Y
151 ROUND
152 x≠? Y
153 BACK 119
154 ALL 00
155 END

I attempted to replace line 63 with "BACK 012" & delete line 50 but the programme then either mis-functioned or produced wrong answers - assistance on this point would be appreciated.
All improvements welcome.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
WP 34S Partition of Integers Programme & a Possible OS Bug - Gerald H - 05-08-2014 10:53 AM



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