Euler problem #17 solution