works normally and if not the program jumps one line. The X?Y functions work in the same way but now the condition is about the lines x and y of the stack and not only about line x.

Example: A kind of “timer”

01 LBL A

021

03-

04X=0?

05 STOP (Enter R/S)

06 GTO A

07 RTN

In this program you first enter a big integer number and then press XEQ “A”. The program will subtract 1 from this number until get zero. Of course the bigger the number the bigger the time the program will spend. The Emu42 program (yes, I use it too) in my laptop using “Authentic Calculator Speed” option takes about 37s for the number 1000. Without this option or using Free42 is too much faster!

6.4 Real program examples.

Here is one of my favorite programs. It just see if a number is prime. (With a small change works in 33S too)

01 LBL “PRIME”

02 STO 00

 

03 2

 

04 STO 01

 

05 MOD

(Rmdr in HP-33S)

06X=0?

07GTO F

083

09STO 01

10RCL 00

11SQRT

12STO 02

13LBL B

14RCL 00

15RCL 01

16MOD

17X=0?

18GTO F

192

20STO + 01

21RCL 02

22RCL 01

23X≤Y?

24GTO B

25RCL 00

26STO 01

27LBL F

28RCL 01

29RTN

Page 22
Image 22
HP 42S manual Real program examples, LBL Prime, Sqrt