faster running version of the euler10 problem.