Solution of project euler 16