public final class MillerRabin extends Object
Modifier and Type | Method and Description |
---|---|
static long |
greatestLEPrime(long n)
Finds and returns the greatest prime number that is lesser than or equal to n.
|
static long |
greatestLEPrime(long n,
int k)
Finds and returns the greatest prime number that is lesser than or equal to n.
|
static boolean |
isPrime(long n)
Tests whether a number is probably prime or not using the Miller-Rabin algorithm.
|
static boolean |
isPrime(long n,
int k)
Tests whether a number is probably prime or not using the Miller-Rabin algorithm.
|
static long |
leastGEPrime(long n)
Finds and returns the smallest prime number that is greater than or equal to n.
|
static long |
leastGEPrime(long n,
int k)
Finds and returns the smallest prime number that is greater than or equal to n.
|
public static boolean isPrime(long n, int k)
n
- The number to be tested.k
- The accuracy of the primality test.public static boolean isPrime(long n)
n
- The number to be tested.public static long leastGEPrime(long n, int k)
n
- The number.k
- The accuracy of the primality test.public static long leastGEPrime(long n)
n
- The number.public static long greatestLEPrime(long n, int k)
n
- The number.k
- The accuracy of the primality test.public static long greatestLEPrime(long n)
n
- The number.Copyright © 2020. All rights reserved.