Solution to this problem https://projecteuler.net/problem=3