Solution of project euler 15