GetOrderOfMagnitudeOfNumber. For x < 10 => 0. For x = 10 => 1. For x = 1000
=> 3, etc.


GetDivisorsOfNumber. For x = 1 => [1]. For x = 20 => [2, 5]


GetNumberOfDivisors


GetGreatestCommonDivisorOf2NumbersBasedOnTheirFactors i.e.
public static ANumber
getGreatestCommonDivisorOf2NumbersBasedOnTheirFactors(List<ANumber>
factorsOfX, List<ANumber> factorsOfY)
{
    factorsOfX.retainAll(factorsOfY);
    Set<ANumber> commonFactors = new HashSet<ANumber>(factorsOfX);
    List<ANumber> commonFactors1 = new ArrayList<ANumber>(commonFactors);
    Collections.sort(commonFactors1);
    return commonFactors1.get(commonFactors1.size() - 1);
}


AreCommensurable i.e.
public static boolean areCommensurable(int x, int y, int z)
{
    return isMultipleOf(x, z) && isMultipleOf(y, z);
}


GetNumberOfDecimalDigitsOfNumber i.e.
public static int run(double x, int precision)
{
    String xTemp = Double.toString(x);
    return Math.min(xTemp.substring(xTemp.indexOf(".") + 1).length(),
precision);
}

Reply via email to