This program calculates a range of prime numbers:

Code:

PRINT "INPUT NUMBERS FOR A RANGE OF PRIMES" INPUT "FIRST NUMBER: ", F# INPUT "LAST NUMBER: ", L# FOR A# = F# TO L# IF (A# + 1) / 6 = INT((A# + 1) / 6) THEN GOTO LBL2 GOSUB LBL1 IF INKEY$ <> "" THEN SYSTEM NEXT A# PRINT SYSTEM LBL2: F# = A# FOR A# = F# TO L# STEP 6 GOSUB LBL1 IF INKEY$ <> "" THEN SYSTEM A# = A# + 2 GOSUB LBL1 IF INKEY$ <> "" THEN SYSTEM A# = A# - 2 NEXT A# PRINT SYSTEM LBL1: IF A# > 999999999999999# THEN PRINT "OUT OF RANGE": SYSTEM IF A# < 1 OR A# <> INT(A#) THEN SYSTEM IF A# = 2 OR A# = 3 THEN PRINT A#; : RETURN C# = (A# + 1) / 6 IF C# = INT(C#) THEN GOSUB M C# = (A# - 1) / 6 IF C# = INT(C#) THEN GOSUB P RETURN P: FOR B# = 1 TO C# A1# = (C# - B#) / (6 * B# + 1): A2# = (C# + B#) / (6 * B# - 1) IF B# > A1# AND B# > A2# THEN PRINT A#; : RETURN IF A1# = INT(A1#) OR A2# = INT(A2#) THEN RETURN NEXT B# RETURN M: FOR B# = 1 TO C# A1# = (C# + B#) / (6 * B# + 1): A2# = (C# - B#) / (6 * B# - 1) IF B# > A1# AND B# > A2# THEN PRINT A#; : RETURN IF A1# = INT(A1#) OR A2# = INT(A2#) THEN RETURN NEXT B# RETURN

## Comment