OFFSET
2,2
COMMENTS
All positive integers are happy numbers in base 2 and base 4; they are called "happy bases". There are no other happy bases < 500,000,000.
LINKS
Antti Karttunen, Table of n, a(n) for n = 2..10082
Antti Karttunen, Data supplement: n, a(n) computed for n = 2..100000
Dino Lorenzini, Mentzelos Melistas, Arvind Suresh, Makoto Suwama, and Haiyang Wang, Integer Dynamics, arXiv:2105.14361 [math.NT], 2021.
MATHEMATICA
Table[If[MemberQ[{2, 4}, n], 0, Block[{k = 2}, While[NestWhile[Total[IntegerDigits[#, n]^2] &, k, UnsameQ, All] == 1, k++]; k]], {n, 2, 105}] (* Michael De Vlieger, Nov 06 2018 *)
PROG
(PARI) A161872(n) = if((2==n)||(4==n), 0, for(k=2, oo, my(visited = Map(), t = k); while(t!=1, if(mapisdefined(visited, t), return(k), mapput(visited, t, t)); t = vecsum(apply(d -> (d*d), digits(t, n)))))); \\ Antti Karttunen, Nov 06 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Jud McCranie, Jun 20 2009
STATUS
approved