1 # The Computer Language Shootout
2 # http://shootout.alioth.debian.org/
4 # contributed by Glenn Parker, March 2005
5 # modified by Evan Phoenix, Sept 2006
26 n
= (ARGV[0] || 2).to_i
28 Flags
= "\x1" * ( 2 ** n
* 10_000)
30 n
.downto(n-2
) do |exponent
|
32 m
= (1 << exponent
) * 10_000
33 # m = (2 ** exponent) * 10_000
35 printf
"Primes up to %8d %8d\n", m
, count