home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
genie-commodore-file-library
/
C64Educational
/
SUPER-PRIMES
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
2KB
|
68 lines
1 POKE808,234
4 PRINT"[147]"
5 GOSUB1000
6 PRINT"[147]"
7 INPUT"WHICH NUMBER WOULD YOU LIKE TO TRY";L
8 TI$="000000"
9 Z=L/2-1
10 DIM A(Z)
20 FORT=1TOZ:A(T)=2*T+1:NEXT
50 X=1
55 A=A(X)
60 FORT=X+ATOZSTEPA:A(T)=0:NEXT
70 X=X+1
80 IFA(X)>SQR(L)THEN100
90 IFA(X)=0THEN70
95 GOTO55
100 PRINT"THE NUMBERS HAVE BEEN CALCULATED IN":T$=TI$:GOSUB500
101 PRINT"PRESS ANY KEY TO SEE LIST.":PRINT"PRESS CTRL[146] KEY TO SLOW LIST."
102 GETX$:IFX$=""THEN102
105 PRINT2
110 FORT=1TOZ
120 IFA(T)<>0THENPRINTA(T)
130 NEXT
131 PRINT"DO YOU WISH TO REVIEW LIST?(Y/N)"
132 GETX$:IFX$=""THEN132
133 IFX$="Y"THENPRINT"[147]":GOTO101
134 PRINT"WOULD YOU LIKE TO TRY A NEW NUMBER? (Y/N)"
135 GETX$:IFX$=""THEN135
136 IFX$="Y"THENPRINT"[147]":RUN7
137 SYS64738
500 M$=MID$(T$,3,2):S$=MID$(T$,5,2)
505 PRINT" ABOUT "M$" MINUTES, "S$" SECONDS"
510 RETURN
1000 POKE53280,0:POKE53281,0:POKE646,4
1005 PRINT"[147]"
1010 PRINT"SUPER PRIMES"
1020 PRINT"BY"
1030 PRINT"NORMAN KRUMPE"
1040 FORT=1TO2000:NEXT
1050 PRINT"PRESS F1[146] TO BEGIN"
1060 GETX$:IFX$<>CHR$(133)THEN1060
1070 PRINT"[147]":PRINT"THE PURPOSE OF THIS PROGRAM"
1080 PRINT"IS TO LIST THE PRIME NUMBERS"
1090 PRINT"UP TO A SPECIFIED POINT."
1100 PRINT"DUE TO LIMITED MEMORY SPACE,"
1110 PRINT"T
21072 OGRAM CAN ONLY LIST "
1120 PRINT"THE PRIMES UP TO 14750."
1130 PRINT"WHEN YOU ENTER A NUMBER,"
1140 PRINT"BE SURE THAT IT IS AN EVEN"
1150 PRINT"NUMBER BETWEEN 10 AND 14750."
1160 PRINT"PRESS F1[146] TO CONTINUE"
1170 GETX$:IFX$<>CHR$(133)THEN1170
1180 PRINT"[147]":PRINT"THE COMPUTER WILL TIME THE"
1190 PRINT"CALCULATION PROCESS."
1200 PRINT"YOU WILL THEN BE GIVEN THE"
1210 PRINT"OPPORTUNITY TO LIST AND RELIST"
1220 PRINT"THE CALCULATED NUMBERS."
1230 PRINT"FINALLY, YOU WILL BE ABLE TO"
1240 PRINT"TRY OTHER NUMBERS."
1250 PRINT"
17747 NOTE!! AS SOON AS YOU"
1260 PRINT"DECIDE TO QUIT, THE PROGRAM"
1270 PRINT"WILL BE ERASED."
1280 PRINT"PRESS F1[146] TO CONTINUE"
1290 GETX$:IFX$<>CHR$(133)THEN1290
1300 RETURN