The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A265525 a(n) = largest base-10 palindrome m <= n such that every base-10 digit of m is <= the corresponding digit of n. 2
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, 22, 22, 22, 0, 11, 22, 33, 33, 33, 33, 33, 33, 33, 0, 11, 22, 33, 44, 44, 44, 44, 44, 44, 0, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
MAPLE
ispal := proc(n) # test for base-b palindrome
local L, Ln, i;
global b;
L := convert(n, base, b);
Ln := nops(L);
for i to floor(1/2*Ln) do
if L[i] <> L[Ln + 1 - i] then return false end if
end do;
return true
end proc
# find max pal <= n and in base-b shadow of n, write in base 10
under10:=proc(n) global b;
local t1, t2, i, m, sw1, L2;
if n mod b = 0 then return(0); fi;
t1:=convert(n, base, b);
for m from n by -1 to 0 do
if ispal(m) then
t2:=convert(m, base, b);
L2:=nops(t2);
sw1:=1;
for i from 1 to L2 do
if t2[i] > t1[i] then sw1:=-1; break; fi;
od:
if sw1=1 then return(m); fi;
fi;
od;
end proc;
b:=10; [seq(under10(n), n=0..144)]; # Gives A265525
PROG
(Haskell)
a265525 n = a265525_list !! n
a265525_list = f a031298_tabf [[]] where
f (ds:dss) pss = y : f dss pss' where
y = foldr (\d v -> 10 * v + d) 0 ys
(ys:_) = dropWhile (\ps -> not $ and $ zipWith (<=) ps ds) pss'
pss' = if ds /= reverse ds then pss else ds : pss
-- Reinhard Zumkeller, Dec 11 2015
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
Sequence in context: A139281 A059707 A256754 * A355223 A348179 A349422
KEYWORD
nonn,base,look
AUTHOR
N. J. A. Sloane, Dec 09 2015
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 May 13 14:28 EDT 2024. Contains 372519 sequences. (Running on oeis4.)