|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.jas.arith.PrimeList
public final class PrimeList
List of big primes. Provides an Iterator for generating prime numbers. Similar to ALDES/SAC2 SACPOL.PRIME list.
Nested Class Summary | |
---|---|
static class |
PrimeList.Range
Range of probable primes. |
Field Summary | |
---|---|
protected java.math.BigInteger |
last
The last prime in the list. |
protected java.util.List<java.math.BigInteger> |
val
The list of probable primes in requested range. |
Constructor Summary | |
---|---|
PrimeList()
Constructor for PrimeList. |
|
PrimeList(PrimeList.Range r)
Constructor for PrimeList. |
Method Summary | |
---|---|
protected boolean |
checkPrimes()
Check if the list contains really prime numbers. |
protected boolean |
checkPrimes(int n)
Check if the list contains really prime numbers. |
java.math.BigInteger |
get(int i)
get prime at index i. |
static java.math.BigInteger |
getLongPrime(int n,
int m)
Method to compute a prime as 2**n - m. |
static java.math.BigInteger |
getMersennePrime(int n)
Method to compute a Mersenne prime as 2**n - 1. |
java.util.Iterator<java.math.BigInteger> |
iterator()
Iterator. |
int |
size()
size of current list. |
java.lang.String |
toString()
toString. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.util.List<java.math.BigInteger> val
protected java.math.BigInteger last
Constructor Detail |
---|
public PrimeList()
public PrimeList(PrimeList.Range r)
r
- size range for primes.Method Detail |
---|
public static java.math.BigInteger getLongPrime(int n, int m)
n
- power for 2.m
- for 2**n - m.
public static java.math.BigInteger getMersennePrime(int n)
n
- power for 2.
protected boolean checkPrimes()
protected boolean checkPrimes(int n)
public java.lang.String toString()
toString
in class java.lang.Object
public int size()
public java.math.BigInteger get(int i)
public java.util.Iterator<java.math.BigInteger> iterator()
iterator
in interface java.lang.Iterable<java.math.BigInteger>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |