Ruby solution to euler07.