login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A193573
Least happy number with next happy number of distance n.
1
31, 68, 7, 19, 23, 1, 219, 293, 70, 193, 208, 32, 748, 1233, 1457, 973, 263, 338, 49, 109, 763, 5606, 239, 1487, 8884, 1933, 1636, 139, 1607, 3932, 409, 18280, 17966, 4366, 4960, 16181, 33464, 3564, 18899, 496, 4995, 566, 144164, 3392, 5066, 388292, 194962, 178085
OFFSET
1,1
COMMENTS
The next term, a(43), equals 144164. [From Harvey P. Dale, Aug 27 2011]
a(88) = 469999871, a(92) = 488849933, a(96) = 1289999763, a(95) = 1688999664, a(104) = 3999991962, a(116) = 5888999662. - Chai Wah Wu, Aug 03 2023
LINKS
Eric Weisstein's World of Mathematics, Happy Number.
EXAMPLE
a(1) = 31 since next happy number is 32 with distance 1.
a(2) = 68 since next happy number is 70 with distance 2.
a(3) = 7 since next happy number is 10 with distance 3.
MATHEMATICA
hapQ[n_]:=Last[NestWhileList[Total[IntegerDigits[#]^2]&, n, !MemberQ[{0, 1, 4, 16, 20, 37, 42, 58, 89, 145}, #]&]]==1; Transpose[With[ {hapnos= Partition[ Select[Range[34000], hapQ], 2, 1]}, Table[First[Select[ hapnos, Last[#]-First[#]==n&]], {n, 42}]]][[1]] (* Harvey P. Dale, Aug 27 2011 *)
PROG
(Python)
from itertools import count
def A193573(n):
a = 1
for k in count(2):
m = k
while m not in {1, 37, 58, 89, 145, 42, 20, 4, 16}:
m = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(m))
if m == 1:
if k-a==n:
return a
a = k # Chai Wah Wu, Aug 03 2023
CROSSREFS
Cf. A007770.
Sequence in context: A142110 A110831 A212723 * A086042 A086051 A109309
KEYWORD
nonn,base
AUTHOR
Martin Renner, Jul 31 2011
EXTENSIONS
a(43) from Harvey P. Dale, Aug 27 2011
a(44)-a(48) from Chai Wah Wu, Aug 03 2023
STATUS
approved