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

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

A065531 Number of palindromes in all base b representations for n, for 2<=b<=n.

Original entry on oeis.org

1, 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, 6
Offset: 1

Views

Author

Naohiro Nomoto, Dec 02 2001

Keywords

Comments

a(1) = 1 by convention, which makes this sequence different from A135551.
Index of first occurrence of k in A037183. - Robert G. Wilson v, Oct 27 2014

Crossrefs

Essentially the same as A135551.

Programs

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

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

A331486 Numbers k which are emirps in more bases 1 < b < k than any previous number.

Original entry on oeis.org

2, 5, 7, 11, 13, 17, 23, 29, 31, 41, 43, 53, 67, 73, 79, 97, 113, 127, 157, 193, 223, 269, 277, 311, 379, 421, 431, 467, 487, 563, 613, 647, 743, 907, 937, 977, 1093, 1193, 1249, 1259, 1373, 1483, 1543, 1637, 1667, 1933, 2239, 2393, 2477, 2521, 2857, 2957, 3083
Offset: 1

Views

Author

Amiram Eldar, Jan 23 2020

Keywords

Comments

The corresponding numbers of bases are 0, 1, 3, 6, 8, 9, 12, 13, 17, 21, 24, ... (see the link for more values).

Examples

			2 is not emirp in any base.
5 is emirp in one base, 3: 5 is 12 in base 3, and 21 in base 3 is 7 which is also a prime.
7 is emirp in 3 bases, 3, 4, and 5.
		

Crossrefs

Programs

  • Mathematica
    emirpQ[n_, b_] := n != (rev = FromDigits[Reverse @ IntegerDigits[n, b], b]) && And @@ PrimeQ[{n, rev}];
    emirpCount[n_] := Length @ Select[Range[2, n - 1], emirpQ[n, #] &];
    seq = {}; emax = -1; Do[e1 = emirpCount[n]; If[e1 > emax, emax = e1; AppendTo[seq, n]], {n, 2, 3000}]; seq

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

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

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

A337294 Composite numbers k that are Smith numbers in a record number of bases 1 < b <= k.

Original entry on oeis.org

4, 10, 15, 27, 42, 60, 72, 78, 174, 204, 222, 378, 438, 663, 1352, 1446, 2022, 2526, 2598, 3462, 4038, 4542, 6054, 12102, 22182, 30336, 35432, 39318, 44358, 55446, 72582, 90726, 99798, 110886, 120966, 157254, 181446, 235878, 288294, 332646, 399174, 432438, 665286
Offset: 1

Views

Author

Amiram Eldar, Aug 21 2020

Keywords

Comments

Values of A002808 at the indices of records of A060209.
The corresponding number of bases are 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 14, 15, 19, 20, 21, 22, 27, 29, 31, 33, 35, 40, 48, 59, 66, 67, 71, 76, 80, 81, 88, 97, 98, 101, 105, 118, 119, 130, 131, 152, 156, 167, 187, ...

Examples

			a(1) = 4 since it is the least composite number and it is not a Smith number in any base 1 < b <= 4.
a(2) = 10 since it is the least number that is a Smith number in any base 1 < b <= 10: 10 = 2 * 5 is, 22_4 = 2_4 * 11_4 in base 4, and 2 + 2 = 2 + (1 + 1) = 4.
		

Crossrefs

Similar sequences: A107129, A330813.

Programs

  • Mathematica
    digSum[n_, b_] := Plus @@ IntegerDigits[n, b]; smithCount[n_] := If[! CompositeQ[n], 0, Module[{c = 0, f = FactorInteger[n]}, p = f[[;; , 1]]; e = f[[;; , 2]]; Do[If[Total[e*(digSum[#, b] & /@ p)] == digSum[n, b], c++], {b, 2, n}]; c]]; seq = {}; cmax = -1; Do[If[CompositeQ[n] && (c = smithCount[n]) > cmax, cmax = c; AppendTo[seq, n]], {n, 1, 666}]; seq
Showing 1-9 of 9 results.