In the spirit of Project Euler, please do not view my solutions.