private static List<Factor> factors(long aNumberToFactor)
    {
        List<Factor> factors = new LinkedList<Factor>();
        int rootNumber = (int) Math.floor( Math.sqrt( aNumberToFactor));
        if (primes == null || primes.length == 0 || primes[primes.length-1] < rootNumber)
        {
            if (primes == null || primes.length == 0)
                System.err.println( "\t\tInitialize primes");
            else
                System.err.println(String.format(
                        "\t\tCalculating new primes because primes[%d] = %d, which is less than %d (sqrt(%d))",
                        primes.length - 1, primes[primes.length - 1], rootNumber, aNumberToFactor));
            PrimeFinder primeFinder = new Eratosthenes();
            primes = primeFinder.primesNotGreaterThan( rootNumber * 10);
        }
        long remainingToFactor = aNumberToFactor;
        for (int prime : primes)
        {
            if (prime < aNumberToFactor)
            {
                // The number of times the current prime factor occurs.
                int factorCount = 0;
                while (remainingToFactor % prime == 0)
                {
                    factorCount++;
                    remainingToFactor /= prime;
                }
                if (factorCount >= 1)
                    factors.add(new Factor(prime, factorCount));
            }
        }
        return factors;
    }