Package org.drip.numerical.common
Class PrimeUtil
java.lang.Object
org.drip.numerical.common.PrimeUtil
public class PrimeUtil
extends java.lang.Object
PrimeUtil implements Generic Prime Number Utility Functions.
- Module = Computational Core Module
- Library = Numerical Analysis Library
- Project = Numerical Quadrature, Differentiation, Eigenization, Linear Algebra, and Utilities
- Package = Primitives/Array Manipulate Format Display Utilities
- Author:
- Lakshmi Krishnamurthy
-
Constructor Summary
Constructors Constructor Description PrimeUtil()
-
Method Summary
Modifier and Type Method Description static boolean
IsPrime(int n)
Indicate if the specified Number is a Prime Numberstatic double
PrimeFactor(int n)
Compute the Prime Factor for a given Integerstatic java.util.TreeMap<java.lang.Integer,java.lang.Integer>
PrimeFactorMap(int n)
Retrieve the Map of Prime Factor Count for the given Numberstatic int
UglyNumber(int n, int a, int b, int c)
Find the n-th ugly number.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
PrimeUtil
public PrimeUtil()
-
-
Method Details
-
PrimeFactorMap
public static final java.util.TreeMap<java.lang.Integer,java.lang.Integer> PrimeFactorMap(int n)Retrieve the Map of Prime Factor Count for the given Number- Parameters:
n
- The Given Number- Returns:
- Map of Prime Factor Count
-
IsPrime
public static final boolean IsPrime(int n)Indicate if the specified Number is a Prime Number- Parameters:
n
- n- Returns:
- The specified Number is Prime
-
PrimeFactor
public static final double PrimeFactor(int n) throws java.lang.ExceptionCompute the Prime Factor for a given Integer- Parameters:
n
- The Integer- Returns:
- Prime Factor for a given Integer
- Throws:
java.lang.Exception
- Thrown if the Inputs are Invalid
-
UglyNumber
public static final int UglyNumber(int n, int a, int b, int c) throws java.lang.ExceptionFind the n-th ugly number. Ugly numbers are positive integers which are divisible by a or b or c.- Parameters:
n
- na
- ab
- bc
- c- Returns:
- The n-th Ugly Number
- Throws:
java.lang.Exception
- Thrown if the Inputs are Invalid
-