Comment by Erik Huang A007770 Happy Numbers: A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits in base-ten, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle that does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers (or sad numbers). GP code: ssd(n)=n=digits(n); sum(i=1, #n, n[i]^2) isA006753(n)=while(n>6, n=ssd(n)); n==1 for(i=1, 1e6, isA006753(i) && print (i)) There are infinitely many happy numbers and infinitely many unhappy numbers. Consider following proof: Let n be a happy number. Then 10n is also a happy number since the sum of the squared digits of 10n equals to the sum of the squared digits of n. Since 1 is a happy number, there are infinitely many happy numbers. Using the same argument, applied to the unhappy number 2, we may conclude there there are infinitely many unhappy numbers.