completed project euler 31 sort of