Fifth problem from ProjectEuler