// $Id: sieve.ici,v 1.0 2003/01/03 11:16:00 dada Exp $ // http://dada.perl.it/shootout // // contributed by Tim Long n := argv[1] ? int(argv[1]) : 1; while (n--) { count := 0; flags := build(8193, "c", 1); for (i := 2; i <= 8192; ++i) { if (flags[i]) { for (k := i + i; k <= 8192; k += i) flags[k] = 0; ++count; } } } printf("Count: %d\n", count);