1 # The Computer Language Shootout
\r
2 # http://shootout.alioth.debian.org/
\r
4 # contributed by Glenn Parker, March 2005
\r
5 # modified by Evan Phoenix, Sept 2006
\r
8 flags = Flags.dup[0,m]
\r
13 unless flags[p].zero?
\r
26 n = 9 # (ARGV[0] || 2).to_i
\r
27 Flags = ("\x1" * ( 2 ** n * 10_000)).unpack("c*")
\r
29 n.downto(n-2) do |exponent|
\r
30 break if exponent < 0
\r
31 m = (1 << exponent) * 10_000
\r
32 # m = (2 ** exponent) * 10_000
\r
34 printf "Primes up to %8d %8d\n", m, count
\r