Solution to problem 52