login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A161872 Smallest unhappy number in base n (or 0 if no unhappy numbers in the base). 4
0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 7, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 (list; graph; refs; listen; history; text; internal format)
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
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
Cf. A031177 (Unhappy numbers in base 10).
Sequence in context: A044948 A044949 A044950 * A278248 A036461 A244478
KEYWORD
nonn
AUTHOR
Jud McCranie, Jun 20 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 16 01:40 EDT 2024. Contains 374343 sequences. (Running on oeis4.)