Solution to euler 62.