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 A265525 #16 Jun 24 2022 14:07:03 %S A265525 0,1,2,3,4,5,6,7,8,9,0,11,11,11,11,11,11,11,11,11,0,11,22,22,22,22,22, %T A265525 22,22,22,0,11,22,33,33,33,33,33,33,33,0,11,22,33,44,44,44,44,44,44,0, %U A265525 11,22,33,44,55,55,55,55,55,0,11,22,33,44,55,66,66,66,66,0,11,22,33,44,55,66,77,77,77,0,11,22,33 %N A265525 a(n) = largest base-10 palindrome m <= n such that every base-10 digit of m is <= the corresponding digit of n. %H A265525 Reinhard Zumkeller, <a href="/A265525/b265525.txt">Table of n, a(n) for n = 0..9999</a> %p A265525 ispal := proc(n) # test for base-b palindrome %p A265525 local L, Ln, i; %p A265525 global b; %p A265525 L := convert(n, base, b); %p A265525 Ln := nops(L); %p A265525 for i to floor(1/2*Ln) do %p A265525 if L[i] <> L[Ln + 1 - i] then return false end if %p A265525 end do; %p A265525 return true %p A265525 end proc %p A265525 # find max pal <= n and in base-b shadow of n, write in base 10 %p A265525 under10:=proc(n) global b; %p A265525 local t1,t2,i,m,sw1,L2; %p A265525 if n mod b = 0 then return(0); fi; %p A265525 t1:=convert(n,base,b); %p A265525 for m from n by -1 to 0 do %p A265525 if ispal(m) then %p A265525 t2:=convert(m,base,b); %p A265525 L2:=nops(t2); %p A265525 sw1:=1; %p A265525 for i from 1 to L2 do %p A265525 if t2[i] > t1[i] then sw1:=-1; break; fi; %p A265525 od: %p A265525 if sw1=1 then return(m); fi; %p A265525 fi; %p A265525 od; %p A265525 end proc; %p A265525 b:=10; [seq(under10(n),n=0..144)]; # Gives A265525 %o A265525 (Haskell) %o A265525 a265525 n = a265525_list !! n %o A265525 a265525_list = f a031298_tabf [[]] where %o A265525 f (ds:dss) pss = y : f dss pss' where %o A265525 y = foldr (\d v -> 10 * v + d) 0 ys %o A265525 (ys:_) = dropWhile (\ps -> not $ and $ zipWith (<=) ps ds) pss' %o A265525 pss' = if ds /= reverse ds then pss else ds : pss %o A265525 -- _Reinhard Zumkeller_, Dec 11 2015 %Y A265525 Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509. %Y A265525 Cf. A002113, A031298, A265558. %K A265525 nonn,base,look %O A265525 0,3 %A A265525 _N. J. A. Sloane_, Dec 09 2015