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 41-50 of 55 results. Next

A249155 Palindromic in bases 6 and 15.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 14, 80, 160, 301, 602, 693, 994, 1295, 1627, 1777, 2365, 2666, 5296, 5776, 6256, 17360, 34720, 51301, 52201, 105092, 155493, 209284, 587846, 735644, 7904800, 11495701, 80005507, 80469907, 83165017, 89731777, 90196177
Offset: 1

Views

Author

Ray Chandler, Oct 27 2014

Keywords

Comments

Intersection of A029953 and A029960.

Examples

			301 is a term since 301 = 1221 base 6 and 301 = 151 base 15.
		

Crossrefs

Programs

  • Mathematica
    palQ[n_Integer, base_Integer] := Block[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]]; Select[Range[10^6] - 1, palQ[#, 6] && palQ[#, 15] &]
  • Python
    from gmpy2 import digits
    def palQ(n, b): # check if n is a palindrome in base b
        s = digits(n, b)
        return s == s[::-1]
    def palQgen(l, b): # generator of palindromes in base b of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1, l+1):
                for y in range(b**(x-1), b**x):
                    s = digits(y, b)
                    yield int(s+s[-2::-1], b)
                for y in range(b**(x-1), b**x):
                    s = digits(y, b)
                    yield int(s+s[::-1], b)
    A249155_list = [n for n in palQgen(8, 6) if palQ(n, 15)] # Chai Wah Wu, Nov 29 2014

A249157 Palindromic in bases 11 and 13.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 84, 366, 510, 732, 876, 1020, 1098, 1242, 1464, 10248, 30252, 31110, 62220, 103704, 146541, 3382050, 3698730, 4391268, 225622530, 272466250, 413186676, 713998530, 801837204, 848770222, 912265732
Offset: 1

Views

Author

Ray Chandler, Oct 27 2014

Keywords

Comments

Intersection of A029956 and A029958.

Examples

			366 is a term since 366 = 303 base 11 and 366 = 222 base 13.
		

Crossrefs

Programs

  • Mathematica
    palQ[n_Integer,base_Integer]:=Block[{idn=IntegerDigits[n,base]},idn==Reverse[idn]];Select[Range[10^6]-1,palQ[#,11]&&palQ[#,13]&]
    Select[Range[0,44*10^5],AllTrue[IntegerDigits[#,{11,13}],PalindromeQ]&] (* The program generates the first 30 terms of the sequence. *) (* Harvey P. Dale, May 15 2025 *)
  • Python
    from gmpy2 import digits
    def palQ(n, b): # check if n is a palindrome in base b
        s = digits(n, b)
        return s == s[::-1]
    def palQgen(l, b): # unordered generator of palindromes in base b of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1, b**l):
                s = digits(x, b)
                yield int(s+s[-2::-1], b)
                yield int(s+s[::-1], b)
    A249157_list = sorted([n for n in palQgen(6,11) if palQ(n,13)]) # Chai Wah Wu, Nov 25 2014

A249158 Palindromic in bases 7 and 29.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 16, 24, 150, 300, 5952, 7752, 7955, 9755, 9958, 11904, 13704, 13907, 14110, 15707, 15910, 392850, 751043, 4585544, 12737804, 12828748, 16380296, 19289406, 19380350, 20228253, 33115710, 395849700, 1339182534
Offset: 1

Views

Author

Ray Chandler, Oct 27 2014

Keywords

Examples

			150 is a term since 150 = 303 base 7 and 150 = 55 base 27.
		

Crossrefs

Programs

  • Mathematica
    palQ[n_Integer,base_Integer]:=Block[{idn=IntegerDigits[n,base]},idn==Reverse[idn]];Select[Range[10^6]-1,palQ[#,7]&&palQ[#,29]&]
  • Python
    from gmpy2 import digits
    def palQ(n, b): # check if n is a palindrome in base b
        s = digits(n, b)
        return s == s[::-1]
    def palQgen(l, b): # unordered generator of palindromes in base b of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1, b**l):
                s = digits(x, b)
                yield int(s+s[-2::-1], b)
                yield int(s+s[::-1], b)
    A249158_list = sorted([n for n in palQgen(8,7) if palQ(n,29)])
    # Chai Wah Wu, Nov 25 2014

A118064 Decimal expansion of the sum of the reciprocals of the palindromic primes A002385 (Honaker's constant).

Original entry on oeis.org

1, 3, 2, 3, 9, 8, 2, 1, 4, 6, 8, 0, 6
Offset: 1

Views

Author

Martin Renner, May 11 2006

Keywords

Comments

From Robert G. Wilson v, Nov 01 2010: (Start)
n \ sum to 10^n
02 1.267099567099567099567099567099567099567099567099567099567099567099567
03 1.320723244590290964212793334437872849720871258315369002493912638038324
05 1.323748402250648554164425746280035962754669829327727800040192015109270
07 1.323964105671202458016249150576217276147952428601889817773483085610332
09 1.323980718065525060936354534562000413901564393192688451911141729415146
11 1.323982026479475203850120990923294207966175748395470136325039323549015
13 1.323982136437462724794656629740867909978221153827990721566573347887836
15 1.323982145891606234777299440047139038371441916546100653011463101470839
17 1.323982146724859090645464845257681674740147563533254654075059843860490
19 1.323982146799188851138232927173756400348958236915409881890097448921521
21 1.323982146805857558347279363344557427339916178257233985191868031567947 (End)

Examples

			1.323982146806...
		

Crossrefs

Programs

  • Mathematica
    (* first obtain nextPalindrome from A007632 *) s = 1/11; c = 1; pp = 1; Do[ While[pp < 10^n, If[PrimeQ@ pp, c++; s = N[s + 1/pp, 64]]; pp = NextPalindrome@ pp]; If[ OddQ@ n, pp = 10^(n + 1); Print[{s, n, c}]], {n, 17}] (* Robert G. Wilson v, May 31 2009 *)
    generate[n_] := Block[{id = IntegerDigits@n, insert = {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}}}, FromDigits@ Join[id, #, Reverse@ id] & /@ insert]; sm = N[Plus @@ (1/{2, 3, 5, 7, 11}), 64]; k = 1; Do [While[k < 10^n, sm = N[sm + Plus @@ (1/Select[ generate@k, PrimeQ]), 128]; k++ ]; Print[{2 n + 1, sm}], {n, 9}] (* Robert G. Wilson v, Nov 01 2010 *)

Formula

Equals Sum_{p} 1/p, where p ranges over the palindromic primes.

Extensions

Corrected by Eric W. Weisstein, May 14 2006
More terms from Robert G. Wilson v, Nov 01 2010
Entry revised by N. J. A. Sloane, May 05 2013

A248889 Palindromic in base 10 and 18.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 171, 323, 343, 505, 595, 686, 848, 1661, 2112, 3773, 23332, 46664, 69996, 262262, 583385, 782287, 859958, 981189, 1254521, 1403041, 1832381, 39388393, 54411445, 55499455, 88844888, 118919811, 191010191
Offset: 1

Views

Author

Mauro Fiorentini, Mar 05 2015

Keywords

Comments

a(54) > 10^12.

Examples

			848 in decimal is 2B2 in base 18, so 848 is in the sequence.
1661 in decimal is 525 in base 18, so 1661 is in the sequence.
1771 in decimal is 587 in base 18, which is not a palindrome, so 1771 is not in the sequence.
		

Crossrefs

Programs

  • Magma
    [n: n in [0..2*10^7] | Intseq(n) eq Reverse(Intseq(n)) and Intseq(n,18) eq Reverse(Intseq(n,18))]; // Vincenzo Librandi, Mar 21 2015
    
  • Maple
    IsPalindromic := proc(n, Base)
        local Conv, i;
        Conv := convert(n, base, Base);
        for i from 1 to nops(Conv) / 2 do
            if Conv [i] <> Conv [nops(Conv) + 1 - i] then
                return false;
            fi:
        od:
        true;
    end proc:
    Base := 18;
    A := [];
    for i from 1 to 10^6 do:
       S := convert(i, base, 10);
       V := 0;
       if i mod 10 = 0 then
          next;
       fi;
       for j from 1 to nops(S) do:
          V := V * 10 + S [j];
       od:
       for j from 0 to 10 do:
          V1 := V * 10^(nops(S) + j) + i;
          if IsPalindromic(V1, Base) then
             A := [op(A), V1];
          fi;
       od:
       V1 := (V - (V mod 10)) * 10^(nops(S) - 1) + i;
       if IsPalindromic(V1, Base) then
          A := [op(A), V1];
       fi;
    od:
    sort(A);
  • Mathematica
    palindromicQ[n_, b_:10] := TrueQ[IntegerDigits[n, b] == Reverse[IntegerDigits[n, b]]]; Select[Range[0, 499], palindromicQ[#] && palindromicQ[#, 18] &] (* Alonso del Arte, Mar 21 2015 *)
  • PARI
    isok(n) = (n==0) || ((d = digits(n, 10)) && (Vecrev(d) == d) && (d = digits(n, 18)) && (Vecrev(d) == d)); \\ Michel Marcus, Mar 14 2015
    
  • Python
    def palgen10(l): # generator of palindromes of length <= 2*l
        if l > 0:
            yield 0
            for x in range(1,l+1):
                n = 10**(x-1)
                n2 = n*10
                for y in range(n,n2):
                    s = str(y)
                    yield int(s+s[-2::-1])
                for y in range(n,n2):
                    s = str(y)
                    yield int(s+s[::-1])
    def palcheck(n, b): # check if n is a palindrome in base b
        s = digits(n, b)
        return s == s[::-1]
    A248889_list = [n for n in palgen10(9) if palcheck(n, 18)]
    # Chai Wah Wu, Mar 23 2015

A375350 a(n) is the smallest number k such that the sum of the bases b, 1 < b < k-1, for which k is palindromic, equals n . If no such number exists, a(n) = -1.

Original entry on oeis.org

5, 8, 25, 12, 14, 10, 89, 107, 16, 67, 20, 18, 109, 331, 187, 227, 95, 157, 26, 409, 28, 24, 45, 191, 65, 241, 58, 85, 57, 44, 161, 299, 63, 62, 401, 42, 40, 337, 50, 36, 74, 56, 99, 52, 94, 1129, 86, 145, 129, 54, 68, 64, 1613, 76, 48, 1073, 175, 533, 559, 341
Offset: 2

Views

Author

Jean-Marc Rebert, Aug 14 2024

Keywords

Examples

			a(7) = 10, because 10 is palindromic in bases 3 (as 101) and 4 (as 22), which are both less than 9. The sum of these bases (3 + 4) is 7, and no smaller number has this property.
Table begins:
  a(2) = 5 = 101_2,
  a(3) = 8 = 22_3,
  a(4) = 25 = 121_4,
  a(5) = 12 = 22_5,
  a(6) = 14 =  22_6,
  a(7) = 10 = 101_3 = 22_4,
  a(8) = 89 = 131_8,
  a(9) = 107 = 1101011_2 = 212_7,
  a(10) = 16 = 121_3 = 22_7.
		

Crossrefs

Programs

  • Maple
    ispali:= proc(x,b) local F; F:= convert(x,base,b);
      andmap(t -> F[t] = F[-t], [$1.. nops(F)/2])
    end proc:
    f:= proc(k) convert(select(b -> ispali(k,b),[$2..k-2]),`+`) end proc:
    N:= 100: # for a(2) .. a(N)
    V:= Vector(N): count:= 0:
    for x from 5 while count < N-1 do
       v:= f(x);
       if v >= 2 and v <=N and V[v] = 0 then V[v]:= x; count:= count+1;  fi
    od:
    convert(V[2..N],list); # Robert Israel, Oct 14 2024
  • PARI
    isok(k, n) = my(s=0); for(b=2, k-2, my(d=digits(k, b)); if (d == Vecrev(d), s += b)); s == n;
    a(n) = my(k=1); while (!isok(k, n), k++); k; \\ Michel Marcus, Aug 14 2024
    
  • Python
    from itertools import count, islice
    from sympy.ntheory import is_palindromic
    def f(n): return sum(b for b in range(2, n-2) if is_palindromic(n, b))
    def agen(): # generator of terms
        adict, n = dict(), 2
        for k in count(4):
            v = f(k)
            if v not in adict:
                adict[v] = k
                while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 60))) # Michael S. Branicky, Oct 15 2024

Formula

A375201(a(n)) = n. - Robert Israel, Oct 15 2024

Extensions

Name clarified by Robert Israel, Oct 15 2024

A069024 Numbers that are palindromic in base 2 as well as in base 10 (initial zeros may be prepended).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 33, 40, 60, 66, 80, 90, 99, 252, 272, 292, 313, 330, 585, 626, 660, 717, 990, 2112, 2720, 2772, 2920, 4224, 5850, 6336, 7447, 7470, 8448, 8580, 9009, 15351, 21120, 22122, 25752, 32223, 39993, 40904, 42240, 44244, 48384
Offset: 1

Views

Author

Amarnath Murthy, Apr 02 2002

Keywords

Examples

			66 in base 2 is 1000010, which is palindromic if rewritten as 01000010.
		

Crossrefs

Cf. A007632.
Intersection of A061917 and A057890.

Programs

  • Maple
    nextpal:= proc(p,d,V,b)
      local i,i2,pp,m,m2;
      pp:=p;
      V[1]:= V[1]+1;
      m2:= floor(d/2);
      i2:= ceil(d/2);
      if d::odd then pp:= pp + b^m2 else pp:= pp + b^m2 + b^(m2-1) fi;
      for i from 1 while V[i] = b do
        V[i]:= 0:
        if i = i2 then
          if d::even then
            ArrayTools:-Extend(V,[1],inplace);
            return b^d+1, d+1, V
          else
            V[i2]:= 1;
            return b^d+1, d+1, V;
          fi;
        fi;
        V[i+1]:= V[i+1]+1;
        if (d::odd and i=1) then pp:= pp + b^(i2-i-1) else
          pp:= pp + b^(i2-i-1) - b^(i2-i+1) fi;
      od;
      return pp, d, V
    end proc:
    count:= 1:
    S:= 0:
    p2[0]:=1: V2[0]:= <1>: d2[0]:= 1:m2:= 0:
    p10[0]:= 1: V10[0]:= <1>: d10[0]:= 1: m10:= 0:
    while count < 100 do
      i2:= min[index]([seq(p2[i],i=0..m2)])-1; p2o:= p2[i2];
      i10:= min[index]([seq(p10[i],i=0..m10)])-1; p10o:= p10[i10];
      if p2o = p10o then
        S:= S, p2o; count:= count+1;
      fi;
      if p2o <= p10o then x, d2[i2], V2[i2]:= nextpal(p2o/2^i2, d2[i2], V2[i2],2); p2[i2]:= 2^i2 *x;
        if i2 = m2 then m2:= m2+1; p2[m2]:= 2^m2; V2[m2]:= <1>; d2[m2]:= 1;
     fi;
      else
        x, d10[i10], V10[i10]:= nextpal(p10o/10^i10, d10[i10], V10[i10],10);
        p10[i10]:= 10^i10 * x;
        if i10 = m10 then m10:= m10+1; p10[m10]:= 10^m10; V10[m10]:= <1>; d10[m10]:= 1
    fi fi od:
    S; # Robert Israel, Apr 01 2024
  • Mathematica
    pal[n_, b_] := (z=IntegerDigits[n, b]) == Reverse[z]; extpal[n_, b_] := If[Mod[n, b]>0, pal[n, b], extpal[n/b, b]]; Select[Range[50000], extpal[ #, 10]&&extpal[ #, 2]&]

Extensions

Edited by Dean Hickerson, Apr 06 2002
0 inserted by Sean A. Irvine, Mar 29 2024

A069025 Smallest power of 2 with digital sum (A007953) n, or 0 if no such number exists.

Original entry on oeis.org

1, 2, 0, 4, 32, 0, 16, 8, 0, 64, 128, 0, 256, 2048, 0, 0, 0, 0, 4096, 8192, 0, 16384, 0, 0, 65536, 32768, 0, 0, 524288, 0, 1048576, 0, 0, 0, 134217728, 0, 16777216, 0, 0, 67108864, 8388608, 0, 268435456, 0, 0, 4398046511104, 2147483648, 0, 0
Offset: 1

Views

Author

Amarnath Murthy, Apr 02 2002

Keywords

Comments

a(3k)=0. In general about half the entries are nonzero.

Examples

			Both 2^4=16 and 2^10=1024 have a digital sum of 7 but 2^4 is the smaller so it is the one presented.
		

Crossrefs

Cf. A007632.

Programs

  • Mathematica
    a = Table[0, {50}]; Do[b = Plus @@ IntegerDigits[2^n]; If[b < 51 && a[[b]] == 0, a[[b]] = 2^n], {n, 0, 10^4}]; a

Extensions

Edited by Robert G. Wilson v, Nov 05 2002

A124334 Nonpalindromes in base 10 that are palindromes in base 2.

Original entry on oeis.org

15, 17, 21, 27, 31, 45, 51, 63, 65, 73, 85, 93, 107, 119, 127, 129, 153, 165, 189, 195, 219, 231, 255, 257, 273, 297, 325, 341, 365, 381, 387, 403, 427, 443, 455, 471, 495, 511, 513, 561, 633, 645, 693, 765, 771, 819, 843, 891, 903, 951, 975
Offset: 1

Views

Author

Tanya Khovanova, Dec 26 2006

Keywords

Examples

			17(10) = 10001(2), a palindrome.
		

Crossrefs

Cf. A007632 = numbers that are palindromic in bases 2 and 10.

Programs

  • Maple
    N:= 10000: # to get the first N entries
    count:= 0:
    for d from 1 while count < N do
       d1:= ceil(d/2); d2:= d - d1;
       for x from 2^(d1-1) to 2^d1 - 1 while count < N do
          if d::even then x1:= x else x1 := floor(x/2) fi;
          L:= convert(x1,base,2);
          y:= 2^(d2)*x + add(L[j]*2^(d2-j),j=1..d2);
          L10:= convert(y,base,10);
          if ListTools[Reverse](L10) = L10 then next fi;
          count:= count+1;
          A[count]:= y;
       od
    od:
    seq(A[n],n=1..N);
    # Robert Israel, Apr 20 2014
  • Mathematica
    Select[Range[1000], Reverse[IntegerDigits[ # ]] != IntegerDigits[ # ] && Reverse[IntegerDigits[ #, 2]] == IntegerDigits[ #, 2] &]
    pal2[n_]:=With[{c=IntegerDigits[n,2]},c==Reverse[c]]; Select[Range[1000],!PalindromeQ[#]&&pal2[#]&] (* Harvey P. Dale, Nov 10 2024 *)

A248899 Numbers that are palindromic in bases 10 and 19.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 666, 838, 1771, 432234, 864468, 1551551, 1897981, 2211122, 155292551, 330050033, 453848354, 467535764, 650767056, 666909666, 857383758, 863828368, 47069796074, 62558085526, 67269596276, 87161116178, 96060106069, 121791197121, 127673376721, 139103301931, 234595595432, 246025520642
Offset: 1

Views

Author

Mauro Fiorentini, Mar 06 2015

Keywords

Comments

Next term > 10^12.

Examples

			838 = 262 in base 19.
		

Crossrefs

Programs

  • Magma
    [n: n in [0..2*10^7] | Intseq(n) eq Reverse(Intseq(n))and Intseq(n, 19) eq Reverse(Intseq(n, 19))]; // Vincenzo Librandi, Mar 08 2015
  • Maple
    IsPalindromic := proc(n, Base)   local Conv, i;
       Conv := convert(n, base, Base);
    for i from 1 to nops(Conv) / 2 do:
        if Conv [i] <> Conv [nops(Conv) + 1 - i] then
           return false:
        fi:
    od:
    return true;
    end proc;
    Base := 19;
    A := [];
    for i from 1 to 10^6 do:
       S := convert(i, base, 10);
       V := 0;
       if i mod 10 = 0 then
          next;
       fi;
       for j from 1 to nops(S) do:
          V := V * 10 + S [j];
       od:
       for j from 0 to 10 do:
          V1 := V * 10^(nops(S) + j) + i;
          if IsPalindromic(V1, Base) then
             A := [op(A), V1];
          fi;
       od:
       V1 := (V - (V mod 10)) * 10^(nops(S) - 1) + i;
       if IsPalindromic(V1, Base) then
          A := [op(A), V1];
       fi;
    od:
    sort(A);
  • Mathematica
    palQ[n_, b_] := Block[{d = IntegerDigits[n, b]}, If[d == Reverse@ d, True, False]]; Select[Range[0, 10^6], And[palQ[#, 10], palQ[#, 19]] &] (* Michael De Vlieger, Mar 07 2015 *)
    b1=10; b2=19; lst={}; Do[d1=IntegerDigits[n, b1]; d2=IntegerDigits[n, b2]; If[d1==Reverse[d1]&&d2==Reverse[d2], AppendTo[lst, n]], {n, 0, 10^7}]; lst (* Vincenzo Librandi, Mar 08 2015 *)
  • PARI
    isok(n) = (n==0) || ((d = digits(n, 10)) && (Vecrev(d) == d) && (d = digits(n, 19)) && (Vecrev(d) == d)); \\ Michel Marcus, Mar 07 2015
    
Previous Showing 41-50 of 55 results. Next