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.

Previous Showing 11-20 of 78 results. Next

A265525 a(n) = largest base-10 palindrome m <= n such that every base-10 digit of m is <= the corresponding digit of n.

Original entry on oeis.org

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
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

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

A265543 a(n) = smallest base-2 palindrome m >= n such that every base-2 digit of n is <= the corresponding digit of m; m is written in base 2.

Original entry on oeis.org

0, 1, 11, 11, 101, 101, 111, 111, 1001, 1001, 1111, 1111, 1111, 1111, 1111, 1111, 10001, 10001, 11011, 11011, 10101, 10101, 11111, 11111, 11011, 11011, 11011, 11011, 11111, 11111, 11111, 11111, 100001, 100001, 110011, 110011, 101101, 101101, 111111, 111111, 101101, 101101, 111111, 111111, 101101, 101101, 111111
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.
See A206913 for the values of m written in base 10.

Programs

  • Maple
    ispal:= proc(n) global b; # test if n is 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 min pal >= n and with n in base-b shadow, write in base 10
    over10:=proc(n) global b;
    local t1,t2,i,m,sw1,L1;
    t1:=convert(n,base,b);
    L1:=nops(t1);
    for m from n to 10*n do
    if ispal(m) then
       t2:=convert(m,base,b);
       sw1:=1;
       for i from 1 to L1 do
          if t1[i] > t2[i] then sw1:=-1; break; fi;
                          od:
       if sw1=1 then return(m); fi;
    fi;
                           od;
    lprint("no solution in over10 for n = ", n);
    end proc;
    # find min pal >= n and with n in base-b shadow, write in base 10
    overb:=proc(n) global b;
    local t1,t2,i,m,mb,sw1,L1;
    t1:=convert(n,base,b);
    L1:=nops(t1);
    for m from n to 10*n do
    if ispal(m) then
       t2:=convert(m,base,b);
       sw1:=1;
       for i from 1 to L1 do
          if t1[i] > t2[i] then sw1:=-1; break; fi;
                          od:
       if sw1=1 then mb:=add(t2[i]*10^(i-1), i=1..nops(t2)); return(mb); fi;
    fi;
                           od;
    lprint("no solution in over10 for n = ", n);
    end proc;
    b:=2;
    [seq(over10(n),n=0..144)]; # A175298
    [seq(overb(n),n=0..144)]; # A265543
  • Mathematica
    sb2p[n_]:=Module[{m=n},While[!PalindromeQ[IntegerDigits[m,2]]|| Min[ IntegerDigits[ m,2]-IntegerDigits[n,2]]<0,m++];FromDigits[ IntegerDigits[ m,2]]]; Array[sb2p,50,0] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 15 2017 *)

A265558 a(n) = smallest base-10 palindrome m >= n such that every base-10 digit of n is <= the corresponding digit of m.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 11, 22, 33, 44, 55, 66, 77, 88, 99, 22, 22, 22, 33, 44, 55, 66, 77, 88, 99, 33, 33, 33, 33, 44, 55, 66, 77, 88, 99, 44, 44, 44, 44, 44, 55, 66, 77, 88, 99, 55, 55, 55, 55, 55, 55, 66, 77, 88, 99, 66, 66, 66, 66, 66, 66, 66, 77, 88, 99, 77, 77, 77, 77, 77, 77, 77, 77, 88, 99, 88, 88
Offset: 0

Views

Author

N. J. A. Sloane, Dec 10 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.
Cf. A265525.

Programs

  • Maple
    For Maple code see A265543.
  • PARI
    a(n,base=10) = { my (d=digits(n,base)); for (k=1, #d\2, d[k]=d[#d+1-k]=max(d[k],d[#d+1-k])); fromdigits(d,base) } \\ Rémy Sigrist, Jun 24 2022

A333016 Smallest palindromic number >= 2^n.

Original entry on oeis.org

1, 2, 4, 8, 22, 33, 66, 131, 262, 515, 1111, 2112, 4114, 8228, 16461, 32823, 65556, 131131, 262262, 524425, 1049401, 2097902, 4194914, 8388838, 16777761, 33555533, 67111176, 134222431, 268444862, 536878635, 1073773701, 2147557412, 4294994924, 8589999858, 17179897171
Offset: 0

Views

Author

Eder Vanzei, Mar 05 2020

Keywords

Examples

			a(10) = 1111, because 2^10 = 1024 and 1111 is the smallest palindromic number >= 1024.
		

Crossrefs

Programs

  • Mathematica
    spn[n_]:=Module[{k=2^n},While[!PalindromeQ[k],k++];k]; Array[spn,40,0] (* Harvey P. Dale, Jun 12 2023 *)
  • PARI
    a(n) = for(k=2^n, oo, if(Vecrev(v=digits(k))==v, return(k))); \\ Jinyuan Wang, Mar 05 2020

Formula

a(n) = A262038(A000079(n)). - Michel Marcus, May 04 2020

Extensions

a(9) corrected by and more terms from Jinyuan Wang, Mar 05 2020

A333770 Smallest palindromic number >= 3^n.

Original entry on oeis.org

1, 3, 9, 33, 88, 252, 737, 2222, 6666, 19691, 59095, 177771, 532235, 1594951, 4783874, 14355341, 43055034, 129141921, 387424783, 1162332611, 3486886843, 10460406401, 31381118313, 94143234149, 282429924282, 847288882748
Offset: 0

Views

Author

Eder Vanzei, Apr 04 2020

Keywords

Examples

			a(10) = 59095, because 3^10 = 59049 and 59095 is the smallest palindromic number >= 59049.
		

Crossrefs

Programs

  • Maple
    digrev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    f:= proc(n) local d,x,y,t;
      d:= ilog10(n)+1;
      if d::even then
        x:= floor(n/10^(d/2));
        t:= x*10^(d/2)+digrev(x);
        if t >= n then return t fi;
        (x+1)*10^(d/2)+digrev(x+1);
      else
        x:= floor(n/10^((d-1)/2));
        t:= x*10^((d-1)/2)+digrev(floor(x/10));
        if t >= n then return t fi;
        y:= x mod 10;
        if y < 9 then return t + 10^((d-1)/2) fi;
        x:= x+1;
        x*10^((d-1)/2)+digrev(floor(x/10));
      fi
    end proc:
    seq(f(3^i),i=0..30); # Robert Israel, May 04 2020
  • PARI
    a(n) = for(k=3^n, oo, if(Vecrev(v=digits(k))==v, return(k)));

Formula

a(n) = A262038(A000244(n)). - Michel Marcus, May 04 2020

A357044 Lexicographic earliest sequence of distinct palindromes (A002113) such that a(n)+a(n+1) is never palindromic.

Original entry on oeis.org

1, 9, 3, 7, 5, 8, 2, 11, 4, 6, 22, 88, 44, 66, 77, 33, 99, 55, 101, 909, 111, 191, 121, 181, 131, 171, 141, 161, 151, 252, 262, 242, 272, 232, 282, 222, 292, 212, 393, 313, 494, 323, 383, 333, 373, 343, 363, 353, 454, 464, 444, 474, 434, 484, 424
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Sep 14 2022

Keywords

Comments

Obviously the sequence cannot contain 0.
It is easy to prove that the sequence is a permutation of the nonzero palindromes (in the sense that it contains each of them exactly once).

Crossrefs

Cf. A002113 (palindromes), A029742 (non-palindromes), A262038 (next palindrome), A357045 (non-palindromes with palindromic sum of neighbors).

Programs

  • PARI
    A357044_first(n, U=[0], a=9)={vector(n,k, k=U[1]; while(is_A002113(a+k=A262038(k+1)) || setsearch(U, k), ); U=setunion(U,[a=k]); while(#U>1 && U[2]==A262038(U[1]+1), U=U[^1]); a)}
    
  • Python
    from itertools import count, islice
    def ispal(n): s = str(n); return s == s[::-1]
    def nextpal(p): # next largest palindrome after palindrome p
        d = str(p)
        if set(d) == {'9'}: return int('1' + '0'*(len(d)-1) + '1')
        h = str(int(d[:(len(d)+1)//2]) + 1)
        return int(h + h[:-1][::-1]) if len(d)&1 else int(h + h[::-1])
    def agen():
        aset, pal, minpal = {1}, 1, 2
        while True:
            an = pal; yield an; aset.add(an); pal = minpal
            while pal in aset or ispal(an+pal): pal = nextpal(pal)
            while minpal in aset: minpal = nextpal(minpal)
    print(list(islice(agen(), 55))) # Michael S. Branicky, Sep 14 2022

A265511 a(n) = largest base-3 palindrome m <= n such that every base-3 digit of m is <= the corresponding digit of n; m is written in base 10.

Original entry on oeis.org

0, 1, 2, 0, 4, 4, 0, 4, 8, 0, 10, 10, 0, 13, 13, 0, 16, 16, 0, 10, 20, 0, 13, 23, 0, 16, 26, 0, 28, 28, 0, 28, 28, 0, 28, 28, 0, 28, 28, 0, 40, 40, 0, 40, 40, 0, 28, 28, 0, 40, 40, 0, 52, 52, 0, 28, 56, 0, 28, 56, 0, 28, 56, 0, 28, 56, 0, 40, 68, 0, 40, 68, 0, 28, 56, 0, 40, 68, 0, 52, 80, 0, 82, 82, 0, 82, 82, 0, 82
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
    F:= proc(n) local L;
      L:= convert(n,base,3);
      if L[1] = 0 then return 0 fi;
      add(min(L[i],L[-i])*3^(i-1),i=1..nops(L))
    end proc:
    map(F, [$0..100]); # Robert Israel, Jan 13 2020

A265523 a(n) = largest base-9 palindrome m <= n such that every base-9 digit of m is <= the corresponding digit of n; m is written in base 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 10, 10, 10, 10, 10, 10, 10, 10, 0, 10, 20, 20, 20, 20, 20, 20, 20, 0, 10, 20, 30, 30, 30, 30, 30, 30, 0, 10, 20, 30, 40, 40, 40, 40, 40, 0, 10, 20, 30, 40, 50, 50, 50, 50, 0, 10, 20, 30, 40, 50, 60, 60, 60, 0, 10, 20, 30, 40, 50, 60, 70, 70, 0, 10, 20, 30, 40, 50, 60, 70, 80, 0, 82, 82
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
    F:= proc(n) local L;
      L:= convert(n,base,9);
    if L[1] = 0 then return 0 fi;
      add(min(L[i],L[-i])*9^(i-1),i=1..nops(L))
    end proc:
    map(F, [$0..100]); # Robert Israel, Jan 13 2020

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

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

Original entry on oeis.org

0, 1, 3, 5, 7, 9, 9, 9, 15, 17, 17, 21, 21, 21, 27, 27, 31, 33, 33, 33, 33, 33, 33, 45, 45, 45, 51, 51, 51, 51, 51, 51, 63, 65, 65, 65, 65, 73, 73, 73, 73, 73, 73, 85, 85, 85, 85, 93, 93, 93, 99, 99, 99, 99, 107, 107, 107, 107, 107, 107, 119, 119, 119, 119, 127, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129
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.
Previous Showing 11-20 of 78 results. Next