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-10 of 10 results.

A106801 Records by number in A037183, by indices in A065531.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 20, 21, 25, 26, 30, 32, 35, 36, 38, 40, 43, 47, 49, 50, 51, 52, 54, 61, 66, 73, 76, 84, 85, 92, 97, 99, 101, 110, 113, 121, 122
Offset: 0

Views

Author

Michael Trott (mtrott(AT)wolfram.com) and Robert G. Wilson v, May 12 2005; extended Jun 06 2005

Keywords

References

  • Michael Trott, The Mathematica Guide Book for Programming, Springer, 2004, page 218.

Crossrefs

Programs

  • Mathematica
    palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[ p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 1}]]; lst = {0, 0}; Do[ If[ Length[ palindromicBases[n]] > lst[[ -1, 1]], AppendTo[lst, {c, n}]], {n, 200000}]; First[ Transpose[ lst]]

A037183 Smallest number that is palindromic (with at least 2 digits) in n bases.

Original entry on oeis.org

3, 5, 10, 21, 36, 60, 80, 120, 180, 264, 252, 360, 300, 960, 900, 720, 1080, 1440, 1800, 1680, 2160, 2880, 5616, 3780, 2520, 3600, 6120, 6720, 6300, 5040, 11340, 7560, 14112, 10800, 9240, 10080, 13860, 12600, 31200, 15120, 22680, 20160, 18480, 39312, 33264, 39600, 25200, 30240
Offset: 1

Views

Author

Erich Friedman, Dec 11 1999

Keywords

Comments

Smallest number k that is palindromic in n bases b, 1 < b < k.
Only a(1), a(2), a(3), a(4) & a(7) are not congruent to 0 (mod 12). - Robert G. Wilson v, Oct 21 2014
First occurrence of k beginning with 0 in A135551. - Robert G. Wilson v, Jun 30 2017

Examples

			3 = 11 in base 2.
5 = 101 in base 2 and 11 in base 4.
10 is a palindrome in bases 3, 4 and 9: 101(3), 22(4) and 11(9). So a(3)=10.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Module[{idn, s = Floor@ Sqrt[n + 1] - 1}, lng = Table[ If[ Reverse[ idn = IntegerDigits[n, b]] == idn, {b}, Sequence @@ {}], {b, 2, s + 1}]; If[ IntegerQ@ Sqrt[n + 1], -1, 0] + Length@ lng + Count[ Mod[n, Range@ s], 0]]; f[n_] := 0 /; n < 3; t = Table[0, {700}]; k = 3; While[k < 1100000001, a = f[k]; If[ t[[a]] == 0, t[[a]] = k; Print[{a, k}]]; k++]; Take[t, 310] (* Robert G. Wilson v, Nov 02 2014 *)

Extensions

More terms from David W. Wilson

A135549 Number of bases b, 1 < b < n-1, in which n is a palindrome.

Original entry on oeis.org

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

Views

Author

John P. Linderman, Feb 26 2008, Feb 28 2008

Keywords

Comments

Every integer n is a palindrome when expressed in unary, or in base n-1 (where it will be 11). So here we assume 1 < b < n-1.
Records for a(n)>=1 are in A107129. - Dmitry Kamenetsky, Oct 22 2015

Crossrefs

Cf. A016038 (non-palindromic numbers in any base 1 < b < n-1)

Programs

  • Mathematica
    a = {0, 0, 0}; For[n = 4, n < 100, n++, c = 0; For[b = 2, b < n - 1, b++, If[IntegerDigits[n, b] == Reverse[IntegerDigits[n, b]], c++ ]]; AppendTo[a, c]]; a (* Stefan Steinerberger, Feb 27 2008 *)
    Table[cnt=0; Do[d=IntegerDigits[n,b]; If[d==Reverse[d], cnt++ ], {b,2,n-2}]; cnt, {n,0,100}] (* T. D. Noe, Feb 28 2008 *)
    Table[Total[Boole[Table[PalindromeQ[IntegerDigits[n,b]],{b,2,n-2}]]],{n,0,120}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Apr 14 2020 *)

Formula

a(n) = A065531(n)-1 = A126071(n)-2 for n>2. - T. D. Noe, Feb 28 2008

A107129 Numbers n which are palindromic in more bases b, 1

Original entry on oeis.org

1, 3, 5, 10, 21, 36, 60, 80, 120, 180, 252, 300, 720, 1080, 1440, 1680, 2160, 2520, 3600, 5040, 7560, 9240, 10080, 12600, 15120, 18480, 25200, 27720, 36960, 41580, 45360, 50400, 55440, 83160, 110880, 131040, 166320, 221760, 277200, 332640, 360360
Offset: 0

Views

Author

Michael Trott (mtrott(AT)wolfram.com) and Robert G. Wilson v, May 12 2005

Keywords

Comments

Records by number in A037183, by indices in A065531.
Except for 3, 5 and 21 they are all even and except for the first seven, they are all multiples of twelve.

Examples

			1 has no palindromic representation in bases 2 to n.
3 = 11_2.
5 = 101_2, 11_4.
10 = 101_3, 22_4, 11_9.
21 = 10101_2, 111_4, 33_6, 11_20.
36960 = 5775_19, 3(90)3_97, (176)(176)_209, (168)(168)_219,
(165)(165)_223, (160)(160)_230, (154)(154)_239, (140)(140)_263, (132)(132)_279,
(120)(120)_307, (112)(112)_329, (110)(110)_335, (105)(105)_351, (96)(96)_384,
(88)(88)_419, (84)(84)_439, (80)(80)_461, (77)(77)_479, (70)(70)_527,
(66)(66)_559, (60)(60)_615, (56)(56)_659, (55)(55)_671, (48)(48)_769,
(44)(44)_839, (42)(42)_879, (40)(40)_923, (35)(35)_1055, (33)(33)_1119,
(32)(32)_1154, (30)(30)_1231, (28)(28)_1319, (24)(24)_1539, (22)(22)_1679,
(21)(21)_1759, (20)(20)_1847, (16)(16)_2309, (15)(15)_2463, (14)(14)_2639,
(12)(12)_3079, (11)(11)_3359, (10)(10)_3695, 88_4619, 77_5279, 66_6159, 55_7391,
44_9239, 33_12319, 22_18479, 11_36959.
		

References

  • Michael Trott, The Mathematica GuideBook for Programming, Springer, 2004, page 218.

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{s = Floor@ Sqrt[n + 1] - 1, b = 2, c = If[IntegerQ@ Sqrt[n + 1], -2, -1]}, While[b < s + 2, idn = IntegerDigits[n, b]; If[ idn == Reverse@ idn, c++]; b++]; c + Count[ Mod[n, Range@ s], 0]]; f[n_] := 0 /; n < 3;
    k = 0; mx = -1; lst = {}; While[ k < 360000001, c = f@ k; If[ c > mx, AppendTo[lst, k]; mx = c]; k++]; lst

A135551 Number of bases b, 1 < b < n, in which n is a palindrome.

Original entry on oeis.org

0, 0, 0, 1, 1, 2, 1, 2, 2, 2, 3, 1, 2, 2, 2, 3, 3, 3, 3, 1, 3, 4, 2, 2, 4, 2, 4, 3, 4, 2, 3, 3, 3, 3, 3, 2, 5, 2, 3, 2, 5, 2, 4, 2, 3, 4, 4, 1, 5, 2, 4, 4, 5, 1, 4, 4, 4, 4, 2, 2, 6, 2, 3, 5, 4, 5, 4, 3, 4, 2, 4, 2, 6, 3, 3, 3, 3, 2, 6, 1, 7, 3, 4, 2, 6, 5, 3, 2, 5, 2, 5, 4, 5, 4, 2, 2, 6, 2, 5, 4, 7, 2, 4, 1, 6
Offset: 0

Views

Author

John P. Linderman, Feb 26 2008, Feb 28 2008

Keywords

Comments

Every integer n is a palindrome when expressed in unary, or in base n-1 (where it will be 11).
First occurrence in A037183.
a(n) is always less than A001221(n) except for 2 and 6; a(n) is always less than A001222(n) except for even powers of twos and 6, 12, 81, 243, 625, 729, 2187, 19683, 59049, ..., . - Robert G. Wilson v, Jul 17 2016

Crossrefs

Essentially the same as A065531.

Programs

  • Mathematica
    palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 1}]]; Array[ Length@ palindromicBases@# &, 105, 0] (* Robert G. Wilson v, Oct 15 2014 *)
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]];
    f[n_] := Block[{s = Ceiling@ Sqrt@ n, b = 2, c = If[ IntegerQ@ Sqrt[4n + 1], -1, 0]}, While[b < s, If[ palQ[n, b], c++]; b++]; c + Count[ Mod[n, Range[s - 1]], 0]]; f[0] = 0; Array[f, 105, 0] (* much faster for large Ns *) (* Robert G. Wilson v, Oct 20 2014 *)

Formula

a(n) = A135549(n) + 1 for n>2; otherwise a(n) = A135549(n) = 0. - Michel Marcus, Oct 15 2014
a(n) = A126071(n) - 1. - Michel Marcus, Mar 07 2015

A087911 Smallest prime p that is a palindrome in n different bases < p.

Original entry on oeis.org

2, 3, 5, 17, 191, 257, 1009, 4561, 4591, 21601, 57601, 54121, 86677, 176401, 415801, 291721, 950041, 1259701, 3049201, 1670761, 6098401, 3880801, 5654881, 13759201, 18618601, 14414401, 18960481, 15135121, 31600801, 45405361, 35814241
Offset: 1

Views

Author

Randy L. Ekl, Oct 17 2003

Keywords

Comments

a(n) = A000040(A137779^(-1)(n)). - Attila Olah (jolafix(AT)gmail.com), May 06 2008, corrected May 08 2008
The sequence is not monotonic: a(10) > a(11) = 54121. - Attila Olah (jolafix(AT)gmail.com), May 06 2008, corrected May 08 2008

Examples

			a(4) = 191 because 191 base 6 = 515, 191 base 9 = 232, 191 base 10 = 191 and 191 base 190 = 11, all palindromes. No numbers less than 191 can be represented in 4 such ways.
a(12) = 54121 because 54121 is a palindrome in 12 different bases, including base 1 and base 54120.
		

Crossrefs

Programs

  • PARI
    q=1; forprime(m=3,20000,count=0; for(b=2,m-1, w=b+1; k=0; i=m; while(i>0,k=k*w+i%b; i=floor(i/b)); l=0; j=k; while(j>0,l=l*w+j%w; j=floor(j/w)); if(l==k,count=count+1,); if(count>q,print1(m,", "); q=count,)))

Extensions

More terms from David Wasserman, Jun 20 2005
Terms a(17)-a(22) computed by Karl Hovekamp, sent by David Wasserman, Dec 19 2006
More terms from Karl Hovekamp, Jan 01 2007

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

A065809 a(n) is the smallest number m > n such that m is palindromic in base n and is not palindromic in bases b with 2 <= b < n.

Original entry on oeis.org

3, 4, 25, 6, 14, 32, 54, 30, 11, 84, 39, 140, 75, 176, 102, 198, 19, 220, 147, 110, 69, 384, 175, 416, 486, 420, 58, 570, 279, 544, 429, 306, 245, 684, 296, 380, 663, 880, 615, 1134, 258, 1012, 1035, 1104, 47, 1392, 539, 1500, 1071, 1508, 53, 2106
Offset: 2

Views

Author

Naohiro Nomoto, Dec 06 2001

Keywords

Comments

Index at which first occurrence of n occurs in A016026 when the palindrome is multidigit. Only the first two terms of A016026 are single-digit palindromes. - Robert G. Wilson v, Dec 22 2021

Examples

			From _Robert G. Wilson v_, Dec 22 2021: (Start)
a(2) = 3 since A016026(3) = 2;
a(3) = 4 since A016026(4) = 3;
a(4) = 25 since A016026(25) = 4; etc. (End)
		

Crossrefs

Programs

Extensions

Definition edited by N. J. A. Sloane, Apr 08 2019

A375387 a(n) is the least number k whose sum of digits in base 10 is n and that is palindromic in base n, or -1 if no such number exists.

Original entry on oeis.org

-1, 130, 41, 123, 16, 170, -1, 55, 155, 39, 274, 239, 96, 187, 494, 2925, 685, 1784, 1389, 859, 599, 1779, 1978, 989, 6597, 5887, 6968, 8499, 5989, 17969, 29859, 17899, 28898, 435897, 38989, 2089469, 1788960, 498847, 2886278, 487878, 919996, 4098689, 898794, 1896967
Offset: 3

Views

Author

Jean-Marc Rebert, Aug 13 2024

Keywords

Comments

A positive integer that is a multiple of 3 ends with 0 in base 3, so it cannot be a palindrome in base 3.
A positive integer that is a multiple of 9 ends with 0 in base 9, so it cannot be a palindrome in base 9.
From Michael S. Branicky, Aug 15 2024: (Start)
Regarding a(2): To be a palindrome in base 2, it must end with 1, hence odd. To be odd and have digit sum 2 in base 10, it must be of the form t_d = 10^(d-1) + 1, d > 1 (a d-digit base-10 number). t_d is not divisible by 3, and base-2 palindromes with even length (i.e., number of binary digits) are divisible by 3, so, if a(2) exists, it must be a base-2 palindrome with odd length.
Computer search shows no such terms with d <= 10^6, so a(2), if it exists, has > 10^6 decimal digits. (End)

Examples

			a(5) = 41, because 4 + 1 = 5 and 41 = 131_5, and no lesser number has this property.
First terms are:
  130 = 2002_4
  41  = 131_5
  123 = 3323_6
  16  = 22_7
  170 = 252_8
		

Crossrefs

Programs

  • PARI
    isok(k, n) = if (sumdigits(k)==n, my(d=digits(k, n)); d==Vecrev(d));
    a(n) = if ((n==3) || (n==9), return((-1))); my(k=1); while (!isok(k,n), k++); k; \\ Michel Marcus, Aug 13 2024
    
  • Python
    # see Links for faster variants
    from itertools import count
    from sympy.ntheory import is_palindromic
    def a(n):
        if n in {3, 9}: return -1
        return next(k for k in count(10**(n//9)-1) if sum(map(int, str(k)))==n and is_palindromic(k, n))
    print([a(n) for n in range(3, 47)]) # Michael S. Branicky, Aug 13 2024

A065708 a(n) is the position of A037183(n) in a sorted list of the terms of A037183.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10, 13, 12, 16, 15, 14, 17, 18, 20, 19, 21, 25, 22, 26, 24, 30, 23, 27, 29, 28, 32, 35, 36, 34, 31, 38, 37, 33, 40, 43, 42, 41, 47, 49, 48, 39, 45, 50, 44, 46, 51, 52, 54, 61, 57, 56, 58, 55, 66, 60, 62, 64, 73, 59, 65, 76, 63
Offset: 1

Views

Author

Naohiro Nomoto, Dec 04 2001

Keywords

Examples

			a(11)=10 because A037183(11)=252 is the 10th largest term in A037181. - _Sean A. Irvine_, Sep 09 2023
		

Crossrefs

Extensions

Name clarified and more terms from Sean A. Irvine, Sep 09 2023
Showing 1-10 of 10 results.