[go: up one dir, main page]

login
A261914
Largest palindrome < n (or 0 if n=0).
3
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55
OFFSET
0,4
FORMULA
a(n) = A261423(n-1) for all n>0. - M. F. Hasler, Sep 11 2015
MAPLE
# Pal has list of palindromes; palfloor is A261423
palfloor:=proc(n) global Pal; local i;
for i from 1 to nops(Pal) do
if Pal[i]=n then return(n); fi;
if Pal[i]>n then return(Pal[i-1]); fi;
od:
end;
prevpal:=proc(n) global palfloor;
if n=0 then return(0);
elif member(n, Pal) then return(palfloor(n-1));
else return(palfloor(n)); fi; end;
MATHEMATICA
lp[n_]:=Module[{k=n-1}, While[!PalindromeQ[k], k--]; k]; Join[{0}, Array[lp, 70]] (* Harvey P. Dale, Oct 17 2022 *)
PROG
(Haskell)
a261914 n = a261914_list !! n
a261914_list = f 0 a002113_list where
f n ps@(p:ps'@(p':_)) = p : f (n + 1) (if n < p' then ps else ps')
-- Reinhard Zumkeller, Sep 16 2015
CROSSREFS
Similar to but of course different from A261423.
Sequence in context: A072139 A266325 A262087 * A261423 A262040 A329200
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Sep 10 2015
STATUS
approved