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.

Showing 1-1 of 1 results.

A265526 Largest base-2 palindrome m <= n, written in base 2.

Original entry on oeis.org

0, 1, 1, 11, 11, 101, 101, 111, 111, 1001, 1001, 1001, 1001, 1001, 1001, 1111, 1111, 10001, 10001, 10001, 10001, 10101, 10101, 10101, 10101, 10101, 10101, 11011, 11011, 11011, 11011, 11111, 11111, 100001, 100001, 100001, 100001, 100001, 100001, 100001, 100001, 100001, 100001, 100001, 100001, 101101, 101101, 101101
Offset: 0

Views

Author

N. J. A. Sloane, Dec 09 2015

Keywords

Crossrefs

Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.

Programs

  • Maple
    ispal:= proc(n) global b; # test for base-b palindrome
      local L, Ln, i;
      L:= convert(n, base, b);
      Ln:= nops(L);
    for i from 1 to floor(Ln/2) do
    if L[i] <> L[Ln+1-i] then return(false); fi;
    od:
    return(true);
    end proc;
    # find max pal <= n, write in base 10
    less10:=proc(n) global b;
    local t1,t2,i,m,sw1,L2;
    t1:=convert(n,base,b);
    for m from n by -1 to 0 do
    if ispal(m) then return(m); fi;
                            od;
    end proc;
    # find max pal <= n, write in base b
    lessb:=proc(n) global b;
    local t1,t2,i,m,mb,sw1,L2;
    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);
       mb:=add(t2[i]*10^(i-1), i=1..L2); return(mb); fi;
                            od;
    end proc;
    b:=2;
    [seq(less10(n),n=0..100)]; # A206913
    [seq(lessb(n),n=0..100)]; # A265526
    [seq(less10(2*n),n=0..100)]; # A265527
    [seq(lessb(2*n),n=0..100)]; # A265528
    b:=10;
    [seq(less10(n),n=0..100)]; # A261423
Showing 1-1 of 1 results.