Problem 8 - initial ugly solution
Problem 8 - two more elegant solutions