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

A303534 Amount by which n exceeds the largest binary palindrome less than or equal to n.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 4, 5, 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3
Offset: 0

Views

Author

Allan C. Wechsler, Apr 25 2018

Keywords

Examples

			The largest binary palindrome that doesn't exceed 30 is 27 (11011 r2). 30 - 27 = 3, so a(30) = 3.
		

Crossrefs

A006995 lists the binary palindromes.
A206913 gives the largest binary palindrome that does not exceed n.
Cf. also A261424 (analog in base 10), A280506, A303536.

Programs

Formula

a(n) = n - A206913(n).

Extensions

More terms from Altug Alkan, Apr 25 2018

A303536 Number of terms in greedy partition of n into binary palindromes.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 3, 2, 3, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4, 1, 2, 3, 2, 3, 2, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 1, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4, 1, 2, 3, 2, 3, 2, 3, 2, 1, 2, 3, 2, 3, 2, 1
Offset: 0

Views

Author

Allan C. Wechsler, Apr 25 2018

Keywords

Comments

The definition and early trajectory are strikingly reminiscent of A259656. The first difference between the two sequences is at n = 38, where A259656 has 4 and this sequence has 2.
Start with n, and repeatedly subtract the largest possible binary palindrome that leaves a nonnegative residue. This sequence gives the number of such steps needed to reach 0.
This sequence is unbounded, since the gaps between binary palindromes are arbitrarily large, but it grows very slowly.
If we search for the smallest partition into binary palindromes, not necessarily greedy, we get another sequence dominated by this one. The first difference is at n = 44. It is believed that this smaller sequence is bounded, but I have not been able to find a claim of the maximum. See Cilleruelo and Luca 2016.
The position where n = 0.. occurs for the first time: 0, 1, 2, 11, 44, 557, 131630, ... - Antti Karttunen and Altug Alkan, May 13 2018

Examples

			For n = 44:
The largest palindrome not exceeding 44 is 33 (100001). 44 - 33 = 11.
The largest palindrome not exceeding 11 is 9 (1001). 11 - 9 = 2.
The largest palindrome not exceeding 2 is 1. 2 - 1 = 1.
The largest palindrome not exceeding 1 is 1. 1 - 1 = 0.
The iteration took 4 steps to reach 0, so a(44) = 4.
For n = 131630; A303534(131630) = 557 and A303534(557) = 44. Since a(44) = 4 (as above), a(557) = 5 and a(131630) = 6. - _Altug Alkan_, Apr 26 2018
		

Crossrefs

Cf. A006995 (binary palindromes), A206913, A259656, A303534.

Programs

Formula

a(0) = 0; for n > 0, a(n) = 1 + a(A303534(n)). [We are iterating the map n -> A303534(n) until zero is reached.] - Antti Karttunen, May 13 2018, after an earlier comment.

Extensions

More terms from Altug Alkan, Apr 25 2018

A206919 Sum of binary palindromes <= n.

Original entry on oeis.org

0, 1, 1, 4, 4, 9, 9, 16, 16, 25, 25, 25, 25, 25, 25, 40, 40, 57, 57, 57, 57, 78, 78, 78, 78, 78, 78, 105, 105, 105, 105, 136, 136, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 214, 214, 214, 214, 214, 214, 265, 265, 265, 265, 265, 265, 265, 265
Offset: 0

Views

Author

Hieronymus Fischer, Feb 18 2012

Keywords

Comments

Sum of binary palindromes A006995(k) <= n.
Different from A206920.

Examples

			a(2)=1, since the only binary palindromes <= 1 are p=0 and p=1;
a(5)=9, since the sum of all binary palindromes <= 5 is 9 = 0 + 1 + 3 + 5.
		

Crossrefs

Programs

  • PARI
    a(n) = sum(k=1, n, my(b=binary(k)); if (b==Vecrev(b), k)); \\ Michel Marcus, Sep 09 2018

Formula

a(n) = Sum_{k=1..A206915(A206913(n))} A006995(k).
a(n) = A206920(A206915(A206913(n))).
Let p = A206913(n) > 3, m = floor(log_2(p)), then
a(n) = (8/7)*((3/4)*(4-(-1)^m)/(3+(-1)^m)*2^(3*floor(m/2))-1) + (floor(p/2^floor(m/2)) mod 2)*p + 2^m + 1 + Sum_{k=1..floor(m/2)-1} (floor(p/2^k) mod 2)*(2^k+2^(m-k)+2^(m-floor(m/2)+1)*(4^(floor(m/2)-k-1)-1)+(2-(-1)^m)*2^floor(m/2)+2^(floor(m/2)-k)*(p-floor((p mod (2^(m-k+1)))/2^k)*2^k)). - [Corrected; missing factor to the sum term (2-(-1)^m) pasted by the author, Sep 08 2018]

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 76 results. Next