Solution of the project euler