simple solution

now to optimize
added memoization

Also realized I was looking at 10,000,000 not 1,000,000