private ArrayList<Integer> factor(long n) {
        ArrayList<Integer> ret = new ArrayList<>();
        int i = 0;

        while (n > 1) {
            int prime = nthPrime(i);

            while (n % prime == 0) {
                ret.add(prime);
                n /= prime;
            }

            ++i;
        }

        return ret;
    }