solution to problem 205 from https://projecteuler.net/