Shortened code golf solution to problem 30