> Given the potential for extension, this should definitely not go in > "ArithmeticUtils" but in a package of its own. > Suggestions on how to lay out the structure? >
Maybe just a class "org.apache.commons.math3.util.Prime" would do ? We can have one or more package private class beneath to do the hard work... for a start, it would contain the following methods: public static boolean isPrime(int n) public static List<Integer> primeFactors(int n) and a few private ones. Later we can extend by adding overloaded versions of those methods with long and/or BigInteger types. Sebastien