Solution to problem 4 of Project Euler