HP Forums
WP 34S Prime power test programme - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: WP 34S Prime power test programme (/thread-1533.html)



WP 34S Prime power test programme - Gerald H - 06-04-2014 09:36 AM

The programme tests whether an input positive integer is prime or the power of a prime. If input is composite "0" is returned, if not the prime of which the input is an integral power.

1 LBL 'PPT'
2 STO 07
3 SIGN
4 STO 06
5 RCL 07
6 STO 08
7 SIGN
8 STO+ 06
9 RCL 06
10 RCL 07
11 ENTER
12 BASE 10
13 ^MOD
14 DECM
15 RCL- 06
16 RCL 07
17 GCD
18 STO 07
19 DEC X
20 x=0?
21 RTN
22 RCL 07
23 PRIME?
24 SKIP 001
25 BACK 020
26 RCL 08
27 ENTER
28 R↓
29 RCL/ Y
30 1
31 x<? Y
32 BACK 004
33 x≠? Y
34 CLx
35 RCL* Z
36 END