Much better solution to the problem.
Also, my first mathematical proof of anything in nearly two decades!