SSEM Programs:
Prime Number Generator
| Written by:
| Bas Wijnen of Holland.
|
| Obtained from:
| The 1998 SSEM Programming Competition.
|
| Description:
| Each time the program is run (pressing the EXEC button) the next prime number in the sequence is generated.
|
| Parameter Lines:
| -
|
| Result Lines:
| 21: generated primes
|
00: JMP 24
01: LDN 21
02: STO 21
03: LDN 21
04: SUB 15
05: STO 21
06: LDN 15
07: STO 22
08: LDN 22
09: STO 22
10: LDN 22
11: SUB 15
12: STO 22
13: SUB 21
14: CMP
15: NUM -1
16: LDN 21
17: STO 23
18: LDN 23
19: SUB 22
20: JMP 0
21: NUM 1
24: NUM 7
25: CMP
26: JPR 0
27: STO 23
28: LDN 23
29: SUB 22
30: CMP
31: JMP 20