ti 58
example programi ported over the prime number test program, developed for the hp15c as comparison. LblA CP CMs STO 01 x<>t 2 x<>t x==t = inv x>=t +/- sto 07 1 inv sum 07 Lbl+ rcl 07 x<>t rcl 07 / 2 = int sto 09 * 2 = inv x==t - 1 SUM 06 rcl 09 sto 07 gto+ Lbl- clr x<>t rcl 06 x==t +/- 1 inv sum 06 Lbl* 2 sum 08 rcl 08 x<>t 9 x==t = 4 x<>t inv x==t / 3 sto 08 Lbl/ x<>t rcl 01 x==t = x<>t sto 02 1 sto 03 rcl 07 sto 10 Lbly^x rcl 10 x<>t rcl 10 / 2 = int sto 09 * 2 = x==t CE SBR B LblCE clr x<>t rcl 09 x==t 1/x sto 10 rcl 03 sto 09 rcl 02 sto 03 SBR B rcl 03 sto 02 rcl 09 sto 03 gto y^x Lbl1/x 1 x<>t rcl 03 x==t * x<>t rcl 01 - 1 = x==t * rcl 06 sto 10 Lbl clr clr x<>t rcl 10 x==t +/- rcl 03 sto 02 SBR B rcl 03 x<>t rcl 01 - 1 = x==t * 1 inv sum 10 gto clr lbl= 1 R/S lbl+/- 0 R/S LBL B rcl 02 * rcl 03 / rcl 01 = inv int * rcl 01 + .5 = int sto 03 inv sbr its somewhat bigger, but the logic is the same. running this program shows the 58 is about half the effective speed of the hp15c. for example to verify the number 99,991 is prime takes this 58c, 6.5 minutes but the 15c does the same computation in 3.25 mins. both times, in fact, demonstrate the extreme slowness of programmable calculators. scicalc on the palm pilot runs similar (but improved) logic to this as part of its factor algorithm and verifies 99,991 is prime without any noticeable delay at all.
. |