Solving project euler #54