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 A209242 #28 Aug 01 2021 12:55:50 %S A209242 8,1,18,1,45,52,50,1,72,125,160,1,128,1,261,260,200,1,425,405,490,1, %T A209242 338,1,657,628,450,848,936,845,1000,832,648,1,1233,1377,800,1,1450, %U A209242 1445,1813,1341,1058,1856,2125,1844,1250,1525,1352,2205,2560,1,2873,1,3200 %N A209242 The largest fixed value (neither happy nor sad) in base n. %C A209242 A number is a fixed value if it is the sum of its own squared digits. Such values >1 are the only numbers that are neither happy (A007770) nor unhappy (A031177) in that base. %C A209242 The number of fixed values in base B (A193583) is equal to one less than the number of divisors of (1+B^2) (Beardon, 1998, Theorem 3.1). %C A209242 No fixed point has more than 2 digits in base B, and the two-digit number a+bB must satisfy the condition that (2a-1)^2+(2b-B)^2=1+B^2 (Beardon, 1998, Theorem 2.5). Since there are a finite number of ways to express 1+B^2 as the sum of two squares (A002654), this limits the search space. %C A209242 Because fixed points have a maximum value of B^2-1 in base B, there are a large number of solutions near perfect squares, x^2. Surprisingly, there are also a large number of points near "half-squares", (x+.5)^2. See "Ulam spiral" in the links. %H A209242 Christian N. K. Anderson, <a href="/A209242/a209242_1.txt">All fixed values</a> in base n for n=3..10000 %H A209242 Christian N. K. Anderson, <a href="/A209242/a209242.gif">Ulam spiral of maximum fixed values in base n</a> for=3..1000 %H A209242 Alan F. Beardon, <a href="http://www.jstor.org/stable/3619884">Sums of Squares of Digits</a>, The Mathematical Gazette, 82(1998), 379-388. %e A209242 a(7)=45 because in base 7, 45 is 63 and 6^2+3^2=45. The other fixed values in base 7 are 32, 25, 10 and (as always) 1. %o A209242 (R) #ya=number of fixed points, yb=values of those fixed points %o A209242 library(gmp); ya=rep(0,200); yb=vector("list",200) %o A209242 for(B in 3:200) { %o A209242 w=1+as.bigz(B)^2 %o A209242 ya[B]=prod(table(as.numeric(factorize(w)))+1)-1 %o A209242 x=1; y=0; fixpt=c() %o A209242 if(ya[B]>1) { %o A209242 while(2*x^2<w) { %o A209242 if(issquare((y=as.numeric(w-x^2)))) { %o A209242 y=sqrt(y) %o A209242 av=(1+rep(c(-1,-1,1,1),2)*rep(c(x,y),e=4))/2 %o A209242 bv=(B+rep(c(-1,1),4)*rep(c(y,x),e=4))/2 %o A209242 ix=av>=0 & av<B & bv>=0 & bv<B & !(av==0 & bv==0) & isint(av) %o A209242 fixpt=c(fixpt,(av+B*bv)[ix]) %o A209242 } %o A209242 x=x+1 %o A209242 } %o A209242 } else fixpt=1 %o A209242 yb[[B]]=sort(unique(fixpt)) %o A209242 } %o A209242 sapply(yb,max) %o A209242 (Python) %o A209242 from sympy.ntheory.digits import digits %o A209242 def ssd(n, b): return sum(d**2 for d in digits(n, b)[1:]) %o A209242 def a(n): %o A209242 m = n**2 - 1 %o A209242 while m != ssd(m, n): m -= 1 %o A209242 return m %o A209242 print([a(n) for n in range(3, 58)]) # _Michael S. Branicky_, Aug 01 2021 %Y A209242 Cf. A007770, A031177. %Y A209242 Cf. A193583. %K A209242 nonn,base %O A209242 3,1 %A A209242 _Christian N. K. Anderson_, Apr 22 2013 %E A209242 Program improved and sequence extended by _Christian N. K. Anderson_, Apr 25 2013.