| java.lang.Object java.math.BitSieve
BitSieve | class BitSieve (Code) | | A simple bit sieve used for finding prime number candidates. Allows setting
and clearing of bits in a storage array. The size of the sieve is assumed to
be constant to reduce overhead. All the bits of a new bitSieve are zero, and
bits are removed from it by setting them.
To reduce storage space and increase efficiency, no even numbers are
represented in the sieve (each bit in the sieve represents an odd number).
The relationship between the index of a bit and the number it represents is
given by
N = offset + (2*index + 1);
Where N is the integer represented by a bit in the sieve, offset is some
even integer offset indicating where the sieve begins, and index is the
index of a bit in the sieve array.
See Also: BigInteger version: 1.6, 02/02/00 author: Michael McCloskey since: 1.3 |
Constructor Summary | |
| BitSieve(BigInteger base, int searchLen) Construct a bit sieve of searchLen bits used for finding prime number
candidates. |
BitSieve | BitSieve(BigInteger base, int searchLen)(Code) | | Construct a bit sieve of searchLen bits used for finding prime number
candidates. The new sieve begins at the specified base, which must
be even.
|
retrieve | BigInteger retrieve(BigInteger initValue, int certainty)(Code) | | Test probable primes in the sieve and return successful candidates.
|
|
|