optimized to finish in 19 seconds instead of 110

instead of using string casting and iterating over each digit in each
number, arithmetic is used to extract each digit from an integral value.
this is dramatically faster.

additionally, instead of a dictionary, a static list is used to capture
the result of the first iteration of calculation.  every single number
from 1 to 10,000,000 will result in no greater than 9^2 * 7 = 567
numbers for the first result of the calculation.  This can be used as a
quick reference table to utilize the results of prior calculations.