dos_compilers/DX-FORTH v430/SIEVE.F

18 lines
343 B
FortranFixed
Raw Normal View History

2024-07-09 18:07:02 +02:00
8190 CONSTANT SIZE
VARIABLE FLAGS SIZE ALLOT
: SIEVE
." primes 10 iterations: "
10 0 DO
FLAGS SIZE -1 FILL
0 SIZE 0 DO
I FLAGS + C@ IF
I 2 * 3 + DUP I + BEGIN
DUP SIZE < WHILE
DUP FLAGS + 0 SWAP C! OVER +
REPEAT DROP DROP 1+
THEN LOOP
LOOP
. ;