OFFSET
1,1
COMMENTS
El-Sedy and Siksek show that there exist arbitrarily long runs of consecutive integers that are happy numbers. So this sequence contains arbitrarily long runs of 1's.
LINKS
Xander Lee Luo, Table of n, a(n) for n = 1..9977
E. El-Sedy and S. Siksek, On happy numbers, Rocky Mountain J. Math. 30 (2000), 565-570.
MATHEMATICA
happyQ[n_] := NestWhile[Plus @@ (IntegerDigits[#]^2) &, n, UnsameQ, All] == 1; Differences @ Select[Range[700], happyQ] (* Amiram Eldar, Aug 06 2022 *)
PROG
(Python)
from itertools import count, islice
def ssd(n): return sum(int(d)**2 for d in str(n))
def ok(n):
while n not in [1, 4]: n = ssd(n) # iterate until fixed point/cycle
return n==1
def agen(): # generator of terms
prevk = 1
for k in count(2):
if ok(k): yield k - prevk; prevk = k
print(list(islice(agen(), 88))) # Michael S. Branicky, Aug 06 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Darío D. Devia, Aug 05 2022
STATUS
approved
