This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A161872 #14 Sep 10 2021 18:29:26 %S A161872 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, %T A161872 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, %U A161872 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 %N A161872 Smallest unhappy number in base n (or 0 if no unhappy numbers in the base). %C A161872 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. %H A161872 Antti Karttunen, <a href="/A161872/b161872.txt">Table of n, a(n) for n = 2..10082</a> %H A161872 Antti Karttunen, <a href="/A161872/a161872.txt">Data supplement: n, a(n) computed for n = 2..100000</a> %H A161872 Dino Lorenzini, Mentzelos Melistas, Arvind Suresh, Makoto Suwama, and Haiyang Wang, <a href="https://arxiv.org/abs/2105.14361">Integer Dynamics</a>, arXiv:2105.14361 [math.NT], 2021. %t A161872 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 *) %o A161872 (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 %Y A161872 Cf. A031177 (Unhappy numbers in base 10). %K A161872 nonn %O A161872 2,2 %A A161872 _Jud McCranie_, Jun 20 2009