int range.
| Modifier and Type | Field and Description |
|---|---|
| public static final int[] | PRIMES
The first 512 prime numbers. |
| public static final int | PRIMES_LAST
The last number in PRIMES. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns: n or 1 if factorization is completed.the number to factorize, must be >= PRIME_LAST+2 and must not contain any factor below PRIME_LAST+2 n, int the upper bound of trial division: if it is reached, the method gives up and returns n. maxFactor, List<Integer> the list where to add the factors. factors)Extract factors in the range |
| public static boolean | Returns: true if n is prime. false if n is definitely composite.number to test: an odd integer ≥ 3 n)Miller-Rabin probabilistic primality test for int type, used in such a way that a result is always guaranteed. |
| public static int | Returns: the part of n which remains to be factored, it is either a prime or a semi-primethe number to factor, must be > 0. n, final List<Integer> the list where to add the factors. factors)Extract small factors. |
| public static List | Returns: the list of prime factors of nthe number to factor n)Factorization by trial division. |
| PRIMES | back to summary |
|---|---|
| public static final int[] PRIMES The first 512 prime numbers.
It contains all primes smaller or equal to the cubic square of Integer.MAX_VALUE.
As a result, | |
| PRIMES_LAST | back to summary |
|---|---|
| public static final int PRIMES_LAST The last number in PRIMES. | |
| SmallPrimes | back to summary |
|---|---|
| private SmallPrimes() Hide utility class. | |
| boundedTrialDivision | back to summary |
|---|---|
| public static int boundedTrialDivision(int n, int maxFactor, List<Integer> factors) Extract factors in the range
| |
| millerRabinPrimeTest | back to summary |
|---|---|
| public static boolean millerRabinPrimeTest(final int n) Miller-Rabin probabilistic primality test for int type, used in such a way that a result is always guaranteed. It uses the prime numbers as successive base therefore it is guaranteed to be always correct. (see Handbook of applied cryptography by Menezes, table 4.1)
| |
| smallTrialDivision | back to summary |
|---|---|
| public static int smallTrialDivision(int n, final List<Integer> factors) Extract small factors. | |
| trialDivision | back to summary |
|---|---|
| public static List Factorization by trial division. | |