|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math3.primes.Primes
public class Primes
Methods related to prime numbers in the range of int:
| Method Summary | |
|---|---|
static boolean |
isPrime(int n)
Primality test: tells if the argument is a (provable) prime or not. |
static int |
nextPrime(int n)
Return the smallest prime greater than or equal to n. |
static List<Integer> |
primeFactors(int n)
Prime factors decomposition |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isPrime(int n)
It uses the Miller-Rabin probabilistic test in such a way that a result is guaranteed: it uses the firsts prime numbers as successive base (see Handbook of applied cryptography by Menezes, table 4.1).
n - number to test.
public static int nextPrime(int n)
n - a positive number.
MathIllegalArgumentException - if n < 0.public static List<Integer> primeFactors(int n)
n - number to factorize: must be ≥ 2
MathIllegalArgumentException - if n < 2.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||