public static LinkedList<BigInteger> tdFactors(BigInteger n)
	{
		// Set a BigInteger var representing #2
		BigInteger two = BigInteger.valueOf(2);
		LinkedList<BigInteger> fs = new LinkedList<BigInteger>();

		// If n < 2, throw an IllegalArgumentException
		if (n.compareTo(two) < 0)
		{
			throw new IllegalArgumentException("must be greater than one");
		}

		// While n is even, add to fs and divide n by two
		while (n.mod(two).equals(BigInteger.ZERO))
		{
			fs.add(two);
			n = n.divide(two);
		}

		// if n is greater than one
		// starting from 3, check if each odd number is a factor
		// of n. If so, then add f to fs and set n to n/f
		//
		// if no, then check next odd number
		// Finally, add the last n to the fs list once out of the while loop.
		if (n.compareTo(BigInteger.ONE) > 0)
		{
			BigInteger f = BigInteger.valueOf(3);
			while (f.multiply(f).compareTo(n) <= 0)
			{
				// If n is a factor of 
				if (n.mod(f).equals(BigInteger.ZERO))
				{
					System.out.println("old n: " + n);
					System.out.println(f);
					fs.add(f);
					n = n.divide(f);
					System.out.println("new n: " + n + "\n");
				}
				else
				{
					f = f.add(two);
				}
			}
			fs.add(n);
		}

		return fs;
	}