Idea for Problem 23
Solved problem 24