Made performance improvements for problem 12.

Now counting divisors by calculating linear combinations of prime
factors.