NumberTheory.java

Read §4 of the Algorithms chapter. Then code this as specified.


import java.math.BigInteger;
import java.util.ArrayList;
public class NumberTheory
{
    public static void main(String[] args)
    {
        //TEST!!!
    }
    /**
     * @param n a nonzero integer
     * @return 1 if n == 1 and n's smallest positive factor otherwise
     * @throws IllegalArgumentException if n == 0
     */
    public static int findSmallestFactor(int n)
    {
        return 0;
    }
    /**
     * @param n a nonzero BigInteger
     * @return 1 if n == 1 and n's smallest positive factor otherwise
     * @throws IllegalArgumentException if n == 0
     * @throws TooBigConniption if no prime factor is found in 32 bit
     * integer range.  You will need to write this exception class.
     */
    public static int findSmallestFactor(BigInteger n)
    {
        return 0;
    }
    /**
     * @param n a nonzero integer
     * @return 1 if n == 1 and an array list of integers containing n's prime factorization
     * otherwise.
     * @throws IllegalArgumentExcepton if n == 0
     */
     public static ArrayList<Integer> primeFactorization(int n)
     {
        return new ArrayList<Integer>();
     }
}