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.

A016038 Strictly non-palindromic numbers: n is not palindromic in any base b with 2 <= b <= n-2.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 11, 19, 47, 53, 79, 103, 137, 139, 149, 163, 167, 179, 223, 263, 269, 283, 293, 311, 317, 347, 359, 367, 389, 439, 491, 563, 569, 593, 607, 659, 739, 827, 853, 877, 977, 983, 997, 1019, 1049, 1061, 1187, 1213, 1237, 1367, 1433, 1439, 1447, 1459
Offset: 1

Views

Author

Keywords

Comments

All elements of the sequence greater than 6 are prime (ab = a(b-1) + a or a^2 = (a-1)^2 + 2(a-1) + 1). Mersenne and Fermat primes are not in the sequence.
Additional comments: if you can factor a number as a*b then it is a palindrome in base b-1, where b is the larger of the two factors. (If the number is a square, then it can be a palindrome in an additional way, in base (sqrt(n)-1)). The a*b form does not work when a = b-1, but of course there are no two consecutive primes (other than 2,3, which explains the early special cases), so if you can factor a number as a*(a-1), then another factorization also exists. - Michael B Greenwald (mbgreen(AT)central.cis.upenn.edu), Jan 01 2002
Note that no prime p is palindromic in base b for the range sqrt(p) < b < p-1. Hence to find non-palindromic primes, we need only examine bases up to floor(sqrt(p)), which greatly reduces the computational effort required. - T. D. Noe, Mar 01 2008
No number n is palindromic in any base b with n/2 <= b <= n-2, so this is also numbers not palindromic in any base b with 2 <= b <= n/2.
Sequence A047811 (this sequence without 0, 1, 2, 3) is mentioned in the Guy paper, in which he reports on unsolved problems. This problem came from Mario Borelli and Cecil B. Mast. The paper poses two questions about these numbers: (1) Can palindromic or nonpalindromic primes be otherwise characterized? and (2) What is the cardinality, or the density, of the set of palindromic primes? Of the set of nonpalindromic primes? - T. D. Noe, Apr 18 2011
From Robert G. Wilson v, Oct 22 2014 and Nov 03 2014: (Start)
Define f(n) to be the number of palindromic representations of n in bases b with 1 < b < n, see A135551.
For A016038, f(n) = 1 for all n. Only the numbers n = 0, 1, 4 and 6 are not primes.
For f(n) = 2, all terms are prime or semiprimes (prime omega <= 2 (A037143)) with the exception of 8 and 12;
For f(n) = 3, all terms are at most 3-almost primes (prime omega <= 3 (A037144)), with the exception of 16, 32, 81 and 625;
For f(n) = 4, all terms are at most 4-almost primes, with the exception of 64 and 243;
For f(n) = 5, all terms are at most 5-almost primes, with the exception of 128, 256 and 729;
For f(n) = 6, all terms are at most 6-almost primes, with the sole exception of 2187;
For f(n) = 7, all terms are at most 7-almost primes, with the exception of 512, 2048 and 19683; etc. (End)

References

  • Paul Guinand, Strictly non-palindromic numbers, unpublished note, 1996.

Crossrefs

Programs

  • Mathematica
    PalindromicQ[n_, base_] := FromDigits[Reverse[IntegerDigits[n, base]], base] == n; PalindromicBases[n_] := Select[Range[2, n-2], PalindromicQ[n, # ] &]; StrictlyPalindromicQ[n_] := PalindromicBases[n] == {}; Select[Range[150], StrictlyPalindromicQ] (* Herman Beeksma, Jul 16 2005*)
    palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[ p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 2}]]; lst = {0, 1, 4, 6}; Do[ If[ Length@ palindromicBases@ Prime@n == 0, AppendTo[lst, Prime@n]], {n, 10000}]; lst (* Robert G. Wilson v, Mar 08 2008 *)
    Select[Range@ 1500, Function[n, NoneTrue[Range[2, n - 2], PalindromeQ@ IntegerDigits[n, #] &]]] (* Michael De Vlieger, Dec 24 2017 *)
  • PARI
    is(n)=!for(b=2,n\2,Vecrev(d=digits(n,b))==d&&return) \\ M. F. Hasler, Sep 08 2015
    
  • Python
    from itertools import count, islice
    from sympy.ntheory.factor_ import digits
    def A016038_gen(startvalue=0): # generator of terms >= startvalue
        return filter(lambda n: all((s := digits(n,b)[1:])[:(t:=len(s)+1>>1)]!=s[:-t-1:-1] for b in range(2,n-1)), count(max(startvalue,0)))
    A016038_list = list(islice(A016038_gen(),30)) # Chai Wah Wu, Jan 17 2024

Formula

a(n) = A047811(n-4) for n > 4. - M. F. Hasler, Sep 08 2015

Extensions

Extended and corrected by Patrick De Geest, Oct 15 1999
Edited by N. J. A. Sloane, Apr 09 2008

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

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

A047811 Numbers n >= 4 that are not palindromic in any base b, 2 <= b <= n/2.

Original entry on oeis.org

4, 6, 11, 19, 47, 53, 79, 103, 137, 139, 149, 163, 167, 179, 223, 263, 269, 283, 293, 311, 317, 347, 359, 367, 389, 439, 491, 563, 569, 593, 607, 659, 739, 827, 853, 877, 977, 983, 997, 1019, 1049, 1061, 1187, 1213, 1237, 1367, 1433, 1439, 1447, 1459
Offset: 1

Views

Author

Keywords

Comments

Sequence A016038 is identical up to four additional terms: 0, 1, 2, 3; see there for more information.
Note that no prime p is palindromic in base b for the range sqrt(p) < b < p-1. Hence to find non-palindromic primes, we need only examine bases up to floor(sqrt(p)), which greatly reduces the computational effort required. - T. D. Noe, Mar 01 2008
This sequence is mentioned in the paper by Richard Guy, in which he reports on unsolved problems. This problem came from Mario Borelli and Cecil B. Mast. The paper poses two questions about these numbers: (1) Can palindromic or nonpalindromic primes be otherwise characterized? and (2) What is the cardinality, or the density, of the set of palindromic primes? Of the set of nonpalindromic primes? - T. D. Noe, Apr 17 2011

Crossrefs

Programs

  • Mathematica
    Select[Range[4,1500],And@@(#!=Reverse[#]&/@Table[IntegerDigits[#,b],{b,2,#/2}])&] (* Harvey P. Dale, May 22 2013 *)
  • PARI
    is(n)=!for(b=2,n\2,Vecrev(d=digits(n,b))==d&&return)&&n>3 \\ M. F. Hasler, Sep 08 2015

Formula

a(n) = A016038(n+4) for all n. - M. F. Hasler, Sep 08 2015

Extensions

Extended (and corrected) by Patrick De Geest, Oct 15 1999
Minor edits by M. F. Hasler, Sep 08 2015

A135550 Number of bases b, 1 < b < n-1, in which n is a palindrome, allowing leading zeros when testing if a number is a palindrome.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 1, 3, 2, 4, 0, 5, 1, 3, 3, 5, 2, 6, 0, 6, 4, 2, 1, 8, 2, 4, 4, 6, 1, 8, 2, 6, 3, 4, 2, 10, 1, 3, 3, 9, 1, 8, 1, 4, 5, 4, 0, 11, 2, 6, 4, 6, 0, 8, 4, 8, 4, 2, 1, 14, 1, 4, 6, 8, 5, 7, 2, 7, 3, 6, 1, 14, 2, 3, 5, 4, 2, 9, 0, 12, 5, 4, 1, 14, 5, 3, 2, 7, 1, 13, 4, 6, 4, 2, 2
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.
Here 4 = 100 counts as a palindrome in base 2, since 00100 is palindromic.

Crossrefs

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

A375201 a(n) is the sum of the bases b with 1 < b < n-1 in which n is a palindrome.

Original entry on oeis.org

0, 2, 0, 2, 3, 2, 7, 0, 5, 3, 6, 6, 10, 6, 13, 0, 12, 12, 10, 3, 23, 4, 20, 10, 22, 4, 23, 7, 22, 12, 20, 6, 41, 6, 22, 12, 38, 5, 37, 6, 31, 24, 31, 0, 56, 6, 40, 22, 45, 0, 51, 20, 43, 30, 28, 4, 82, 6, 35, 34, 53, 26, 63, 11, 52, 22, 56, 7, 91, 10, 42, 38, 55, 10, 87, 0, 91, 34, 52, 5, 112, 29
Offset: 4

Views

Author

Robert Israel, Oct 15 2024

Keywords

Comments

If n = s*t is composite with s <= t-2, then n = s * (t-1) + s is a two-digit palindrome in base t-1, while s^2 = (s-1)^2 + 2 * (s-1) + 1 is a palindrome in base s-1. Thus a(n) >= sqrt(n)-1 for composite n > 6. On the other hand, there may be infinitely many primes for which a(n) = 0 (see A016038).

Examples

			a(10) = 7 because 10 = 101_3 = 22_4 is a palindrome in bases 3 and 4, and 3 + 4 = 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:
    map(f, [$4 .. 100]);
  • Python
    from sympy.ntheory import is_palindromic
    def a(n): return sum(b for b in range(2, n-2) if is_palindromic(n, b))
    print([a(n) for n in range(4, 86)]) # Michael S. Branicky, Oct 15 2024

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

A229123 a(n) gives the number of bases, b>1, in which n is an early bird.

Original entry on oeis.org

0, 0, 1, 0, 2, 2, 3, 2, 3, 2, 4, 3, 6, 4, 5, 3, 7, 2, 7, 5, 7, 6, 7, 4, 9, 7, 6, 5, 8, 5, 10, 4, 8, 8, 7, 5, 13, 8, 8, 6, 12, 7, 12, 7, 8, 11, 11, 5, 13, 9, 12, 9, 11, 5, 13, 11, 13, 12, 12, 5, 17, 11, 11, 8, 13, 9, 14, 9, 12, 7, 14, 8, 18, 11, 9, 11, 13, 11
Offset: 1

Views

Author

Paul Tek, Sep 14 2013

Keywords

Comments

A number n is called an early bird in base b, if its digits in base b appear in the concatenation of the digits in base b of the numbers from 1 to n-1.

Examples

			The number 1 is never an early bird, so a(1)=0.
The number 3 is an early bird only in base 2, so a(3)=1.
The number 7 is an early bird in bases 2, 3 and 5, so a(7)=3.
		

Crossrefs

Programs

  • C
    See Link section.
Showing 1-10 of 10 results.