This was one of the more difficult problems from the WCS 2013 Competition. There is another version of this problem on ProjectEuler, which this could be extended to match the output. Overall, at Project Euler this has only been solved 75 times.