Golfed problem 8