object dummy "dummy" { } global squared = byte_array(16) { 0, 1, 4, 9, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225 }; global marked = byte_array(256); routine Sieve [; i j k] { for (i=2; i<=16; ++i) if (iszero marked[i]) for (j=squared[i]; j<256; j=j+i) marked[j] = 1; print "All primes between 2 and 255: "; for (i=2; i<256; ++i) if (iszero marked[i]) { print_num(i); print ", "; ++k; } print_ret "done. Found ",k," primes total."; } routine main [] { Sieve(); quit; }