Code: Select all
LBL "PS"
6
/
INT
6
*
1
+
STO 01
LBL 00
XEQ 01
4
ST+ 01
XEQ 01
2
ST+ 01
GTO 00
LBL 01
5
STO 02
LBL 02
RCL 01
RCL 02
MOD
X=0?
RTN
2
ST+ 02
RCL 01
RCL 02
MOD
X=0?
RTN
4
ST+ 02
RCL 01
SQRT
RCL 02
X<=Y?
GTO 02
"P="
ARCL 01
AVIEW
PSE
END
Computes prime numbers starting from x (>= 11) approx. 30% faster than "PZ"
Input: <x> R/S
Output: starts with a prime number next to x