public final class PrimeInteger extends java.lang.Object
org/matheclipse/core/expression/Primality.java
for Pollard
algorithm.Modifier and Type | Field and Description |
---|---|
static long |
BETA
Maximal long, which can be factored by IFACT(long).
|
static java.util.List<java.lang.Long> |
SMPRM
List of small prime numbers.
|
static java.util.List<java.lang.Long> |
UZ210
List of units of Z mod 210.
|
Constructor and Description |
---|
PrimeInteger() |
Modifier and Type | Method and Description |
---|---|
static java.util.SortedMap<java.math.BigInteger,java.lang.Integer> |
factors(java.math.BigInteger n)
Integer factorization. n is a positive integer.
|
static java.util.SortedMap<java.lang.Long,java.lang.Integer> |
factors(long n)
Integer factorization. n is a positive integer.
|
static java.util.SortedMap<java.lang.Long,java.lang.Integer> |
factorsPollard(long n)
Integer factorization, Pollard rho algorithm. n is a positive integer.
|
static void |
factorsPollardRho(java.math.BigInteger n,
java.util.SortedMap<java.math.BigInteger,java.lang.Integer> F)
Integer factorization using Pollards rho algorithm. n is a positive
integer.
|
static void |
factorsPollardRho(long n,
java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
Integer factorization using Pollards rho algorithm. n is a positive
integer.
|
static java.util.List<java.lang.Long> |
getUZ210()
Compute units of Z sub 210.
|
static boolean |
isFactorization(long n,
java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
Test factorization. n is a positive integer. r is true, if n =
product_i(pi**ei), else false.
|
static boolean |
isPrime(long n)
Integer primality test. n is a positive integer. r is true, if n is
prime, else false.
|
static boolean |
isPrimeFactorization(long n,
java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
Test prime factorization. n is a positive integer. r is true, if n =
product_i(pi**ei) and each pi is prime, else false.
|
static long |
largePrimeDivisorSearch(long n,
long a,
long b)
Integer large prime divisor search. n is a positive integer with no prime
divisors less than 17. 1 le a le b le n.
|
static long |
mediumPrimeDivisorSearch(long n,
long a,
long b)
Integer medium prime divisor search. n, a and b are positive integers
such that a le b le n and n has no positive divisors less than a.
|
static int |
primalityTestSelfridge(long m,
long mp,
java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
Integer selfridge primality test. m is an integer greater than or equal
to 3. mp=m-1.
|
static java.util.List<ModLong> |
residueListFermat(long n)
Fermat residue list. n is a positive integer with no prime divisors less
than 17. m is a positive beta-integer and L is an ordered list of the
elements of Z(m) such that if x**2-n is a square then x is congruent to a
(modulo m) for some a in L.
|
static java.util.List<ModLong> |
residueListFermatSingle(long m,
long a)
Fermat residue list, single modulus. m is a positive beta-integer. a
belongs to Z(m).
|
static java.math.BigInteger |
smallPrimeDivisors(java.math.BigInteger n,
java.util.SortedMap<java.math.BigInteger,java.lang.Integer> F)
Integer small prime divisors. n is a positive integer.
|
static long |
smallPrimeDivisors(long n,
java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
Integer small prime divisors. n is a positive integer.
|
static java.util.List<java.lang.Long> |
smallPrimes(long m,
int K)
Digit prime generator.
|
public static final long BETA
public static final java.util.List<java.lang.Long> SMPRM
public static final java.util.List<java.lang.Long> UZ210
public PrimeInteger()
public static java.util.List<java.lang.Long> smallPrimes(long m, int K)
m
- start integerK
- number of integerspublic static long smallPrimeDivisors(long n, java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
n
- integer to factor.F
- a map of pairs of prime numbers and multiplicities (p,e) with p**e
divides n and e maximal, F is modified.public static java.math.BigInteger smallPrimeDivisors(java.math.BigInteger n, java.util.SortedMap<java.math.BigInteger,java.lang.Integer> F)
n
- integer to factor.F
- a map of pairs of prime numbers and multiplicities (p,e) with p**e
divides n and e maximal, F is modified.public static boolean isPrime(long n)
n
- integer to test.public static boolean isPrimeFactorization(long n, java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
n
- integer to test.F
- a map of pairs of prime numbers (p,e) with p**e divides n.public static boolean isFactorization(long n, java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
n
- integer to test.F
- a map of pairs of numbers (p,e) with p**e divides n.public static java.util.SortedMap<java.lang.Long,java.lang.Integer> factors(long n)
n
- integer to factor.public static java.util.SortedMap<java.lang.Long,java.lang.Integer> factorsPollard(long n)
n
- integer to factor.public static long mediumPrimeDivisorSearch(long n, long a, long b)
n
- integer to factor.a
- lower bound.b
- upper bound.public static int primalityTestSelfridge(long m, long mp, java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
m
- integer to test.mp
- integer m-1.F
- a map of pairs (p,e), with primes p, multiplicity e and with
p**e divides mp and e maximal.public static long largePrimeDivisorSearch(long n, long a, long b)
n
- integer to factor.a
- lower bound.b
- upper bound.public static java.util.List<ModLong> residueListFermatSingle(long m, long a)
m
- integer to factor.a
- element of Z mod m.public static java.util.List<ModLong> residueListFermat(long n)
n
- integer to factor.public static java.util.List<java.lang.Long> getUZ210()
public static java.util.SortedMap<java.math.BigInteger,java.lang.Integer> factors(java.math.BigInteger n)
n
- integer to factor.public static void factorsPollardRho(java.math.BigInteger n, java.util.SortedMap<java.math.BigInteger,java.lang.Integer> F)
n
- integer to factor.F
- a map of pairs of numbers (p,e) with p**e divides n and p is
probable prime, F is modified.public static void factorsPollardRho(long n, java.util.SortedMap<java.lang.Long,java.lang.Integer> F)
n
- integer to factor.F
- a map of pairs of numbers (p,e) with p**e divides n and p is
probable prime, F is modified.