solution to project euler problem 22. 1 liner stolen from @jeek