1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-10-01 14:57:08 +00:00
This commit is contained in:
David Schmenk 2014-07-07 20:54:39 -07:00
parent 0c0f8b6fa8
commit ccdc1f3239

View File

@ -1,15 +1,3 @@
;10 S=8190: DIM F(8191): N=0
;20 FOR I=0 TO S: F(I)=1: NEXT I
;30 FOR I=0 TO S
; IF F(I)=0 THEN 80
;40 P=I+I+3: K=I+P
;50 IF K>S THEN 70
;60 F(K)=0: K=K+P
; GOTO 50
;70 N=N+1: REM PRINT P;" ";
;80 NEXT I
;90 PRINT: PRINT N;" PRIMES": END
import STDLIB
predef syscall, call, memset, getc, putc, puts, putln
byte MACHID
@ -18,9 +6,9 @@ end
const FALSE = 0
const TRUE = !FALSE
const maxPrime = 8190
const numPrimes = maxPrime+1
const nums = maxPrime+1
byte flag[numPrimes]
byte flag[nums]
byte iter
word prime, i, k, count
byte strPrimes[] = " primes.\n"
@ -44,7 +32,7 @@ end
beep
for iter = 1 to 10
memset(@flag, numPrimes, TRUE)
memset(@flag, nums, TRUE)
count = 0
for i = 0 to maxPrime
if flag[i]