Class MathUtil
java.lang.Object
org.emau.icmvc.ganimed.ttp.psn.utils.MathUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetMaxPrimeFactorsFor(int number) static int[]getPrimeFactors(int number) Returns an array with all prime factors of the given number.static booleanisPrime(int number) Returns invalid input: 'true, if the given number is a prime] @param number the number to test'.static booleanisPrimePower(int number) Returns true, if the given number is a prime power.
-
Constructor Details
-
MathUtil
public MathUtil()
-
-
Method Details
-
getPrimeFactors
public static int[] getPrimeFactors(int number) Returns an array with all prime factors of the given number.if factors appear more then once, they are returned ordered in their multiplicity, e.g. 180 -> [2,2,3,3,5]
- Parameters:
number- the number to test- Returns:
- an array with all prime factors of the given number
-
getMaxPrimeFactorsFor
public static int getMaxPrimeFactorsFor(int number) -
isPrimePower
public static boolean isPrimePower(int number) Returns true, if the given number is a prime power.- Parameters:
number- the number to test- Returns:
- true, if the given number is a prime power
-
isPrime
public static boolean isPrime(int number) Returns invalid input: 'true, if the given number is a prime] @param number the number to test'.- Returns:
- invalid input: 'true, if the given number is a prime] @param number the number to test'
-