login
This site is supported by donations 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). 2
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

Antti Karttunen, Table of n, a(n) for n = 2..10082

Antti Karttunen, Data supplement: n, a(n) computed for n = 2..100000

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

Adjacent sequences:  A161869 A161870 A161871 * A161873 A161874 A161875

KEYWORD

nonn,changed

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 | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 19 05:29 EST 2018. Contains 317333 sequences. (Running on oeis4.)