initial solution euler #67. TODO: Needs cleanup!