swift version of project euler problem 6