|
|
A356412
|
|
First differences of A007770 (happy numbers).
|
|
0
|
|
|
6, 3, 3, 6, 4, 5, 3, 1, 12, 5, 19, 2, 9, 3, 4, 5, 3, 3, 3, 3, 6, 20, 1, 3, 6, 28, 9, 12, 2, 2, 1, 10, 5, 11, 7, 4, 6, 3, 23, 1, 17, 11, 2, 8, 1, 8, 3, 6, 1, 6, 3, 2, 7, 18, 6, 3, 2, 1, 8, 3, 4, 3, 5, 1, 5, 7, 5, 31, 6, 18, 5, 9, 9, 3, 6, 40, 20, 7, 2, 1, 42, 9, 5, 1, 9, 3, 2, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
E. El-Sedy and S. Siksek, On happy numbers, Rocky Mountain J. Math. 30 (2000), 565-570.
|
|
FORMULA
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|