Solved problem 6

This seems much easier than the problems that preceded it.