Problem 5 solved (slow to compute solution)