Problem 49 solution. First 50 completed\!