public final class BigIntegerUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static BigInteger |
abs(BigInteger a) |
static BigInteger |
binomial(int n,
int k)
Binomial coefficient
|
static BigInteger |
factorial(int number)
Factorial of a number
|
static BigInteger |
gcd(BigInteger[] integers,
int from,
int to)
Returns the greatest common an array of longs
|
static BigInteger |
gcd(BigInteger a,
BigInteger b) |
static BigInteger |
max(BigInteger a,
BigInteger b) |
static BigInteger[] |
perfectPowerDecomposition(BigInteger n)
Tests whether
n is a perfect power n == a^b and returns {a, b} if so and null
otherwise |
static BigInteger |
pow(BigInteger base,
BigInteger exponent)
Returns
base in a power of e (non negative) |
static BigInteger |
pow(BigInteger base,
int exponent)
Returns
base in a power of e (non negative) |
static BigInteger |
pow(BigInteger base,
long exponent)
Returns
base in a power of e (non negative) |
static BigInteger |
pow(long base,
long exponent)
Returns
base in a power of e (non negative) |
static BigInteger |
sqrtCeil(BigInteger val)
Returns ceil square root of
val |
static BigInteger |
sqrtFloor(BigInteger val)
Returns floor square root of
val |
public static BigInteger max(BigInteger a, BigInteger b)
public static BigInteger abs(BigInteger a)
public static BigInteger gcd(BigInteger a, BigInteger b)
public static BigInteger gcd(BigInteger[] integers, int from, int to)
integers - array of longsfrom - from position (inclusive)to - to position (exclusive)public static BigInteger pow(long base, long exponent)
base in a power of e (non negative)base - baseexponent - exponent (non negative)base in a power of eArithmeticException - if the result overflows a longpublic static BigInteger pow(BigInteger base, long exponent)
base in a power of e (non negative)base - baseexponent - exponent (non negative)base in a power of eArithmeticException - if the result overflows a longpublic static BigInteger pow(BigInteger base, int exponent)
base in a power of e (non negative)base - baseexponent - exponent (non negative)base in a power of eArithmeticException - if the result overflows a longpublic static BigInteger pow(BigInteger base, BigInteger exponent)
base in a power of e (non negative)base - baseexponent - exponent (non negative)base in a power of eArithmeticException - if the result overflows a longpublic static BigInteger sqrtFloor(BigInteger val) throws IllegalArgumentException
valval - the numberIllegalArgumentExceptionpublic static BigInteger sqrtCeil(BigInteger val) throws IllegalArgumentException
valval - the numberIllegalArgumentExceptionpublic static BigInteger[] perfectPowerDecomposition(BigInteger n)
n is a perfect power n == a^b and returns {a, b} if so and null
otherwisen - the number{a, b} so that n = a^b or null is n is not a perfect powerpublic static BigInteger factorial(int number)
public static BigInteger binomial(int n, int k)
Copyright © 2022. All rights reserved.