cp's OEIS Frontend

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.

A261914 Largest palindrome < n (or 0 if n=0).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 10 2015

Keywords

Crossrefs

Similar to but of course different from A261423.

Programs

  • 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
  • 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 *)

Formula

a(n) = A261423(n-1) for all n>0. - M. F. Hasler, Sep 11 2015