PRIME

Program tests, whether is a given number prime number. It displays the remaining time during the process.

Source code (190 B)


CLRT
PRINT"NUMBER
INPUT N
IF N<3+9FPART .5N GOTO 3
IF =FPART .5NFPART N3 GOTO 2
P=E9
T=5
X=√N
LABEL 1
M=1+INT (.0378(X-T
IF 0≠INT MP-1+FPART M GOTO 4
CLRT
PRINT"REMAINS
PRINT M
P=M
LABEL 4
IF =FPART (N/T)FPART (N/(T+2 GOTO 2
T=T+6
IF T<=X GOTO 1
LABEL 3
CLRT
PRINT"PRIME NUMBER
END
LABEL 2
CLRT
PRINT"COMPOUND