n = (limit - 2)/2
sievesz = (n + me._NBIT - 1)/me._NBIT
me._sievemax = sievesz*me._NBIT
- me._bits = n*[0]
+ me._bits = sievesz*[0]
## This is standard Sieve of Eratosthenes. For each index i: if
## bit i is clear, then p = 2 i + 3 is prime, so set the bits
## If the label is already taken then we have a problem.
if step.label in me._steps:
- raise ValueError('duplicate label `%s\'' % step.label)
+ raise ExpectedError('duplicate label `%s\'' % step.label)
## Store the proof step.
me._pmap[step.p] = step.label
## Prepare an option parser.
op = OP.OptionParser(
usage = '''\
-pock [-qv] CMD ARGS...
+pock [-qv] [-s SIEVEBITS] CMD ARGS...
gen NBITS
ll NBITS NSUBBITS
check [FILE]''',
description = 'Generate or verify certified prime numbers.')
op.add_option('-v', '--verbose', dest = 'verbosity',
action = 'count', default = 1,
- help = 'Print mysterious runes while looking for prime numbers.')
+ help = 'print mysterious runes while looking for prime numbers')
op.add_option('-q', '--quiet', dest = 'quietude',
action = 'count', default = 0,
- help = 'be quiet while looking for prime numbers.')
+ help = 'be quiet while looking for prime numbers')
op.add_option('-s', '--sievebits', dest = 'sievebits',
type = 'int', default = 32,
- help = 'Size (in bits) of largest small prime.')
+ help = 'size (in bits) of largest small prime')
opts, argv = op.parse_args()
VERBOSITY = opts.verbosity - opts.quietude
p = ProgressReporter()