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.

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

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

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

A384212 a(n) is the number of bases >= 2 in which the alternating sum of digits of n is equal to 0.

Original entry on oeis.org

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

Views

Author

Felix Huber, May 24 2025

Keywords

Comments

The alternating sum of digits of n is equal to 1 for base n and equal to n for bases > n.

Examples

			a(72) = 10 because the alternating sum of digits of n is equal to 0 in the 10 bases 2 [1, 0, 0, 1, 0, 0, 0], 3 [2, 2, 0, 0], 5 [2, 4, 2], 7 [1, 3, 2], 8 [1, 1, 0], 11 [6, 6], 17 [4, 4], 23 [3, 3], 35 [2, 2] and 71 [1, 1].
		

Crossrefs

Programs

  • Maple
    A384212:=proc(n)
        local a,b,c,i;
        a:=0;
        for b from 2 to n-1 do
            c:=convert(n,'base',b);
        	   if add(c[i]*(-1)^i,i=1..nops(c))=0 then
               a:=a+1
            fi
        od;
        return a
    end proc;
    seq(A384212(n),n=1..87);
    A384212bases:=proc(n)
        local L,b,c,i;
        L:=[];
        for b from 2 to n-1 do
            c:=convert(n,'base',b);
        	if add(c[i]*(-1)^i,i=1..nops(c))=0 then
                L:=[op(L),b,ListTools:-Reverse(c)]
            fi
        od;
        return op(L)
    end proc;
    A384212bases(72);
  • Mathematica
    q[n_, b_] := Module[{d = IntegerDigits[n, b]}, Sum[(-1)^k*d[[k]], {k, 1, Length[d]}] == 0 ]; a[n_] := Count[Range[2, n-1], ?(q[n, #] &)]; Array[a, 100] (* _Amiram Eldar, May 24 2025 *)
  • PARI
    a(n) = sum(b=2, n-1, my(d=digits(n, b)); sum(k=1, #d, (-1)^k*d[k]) == 0); \\ Michel Marcus, May 24 2025
  • Python
    from sympy.ntheory import digits
    def s(v): return sum(v[::2]) - sum(v[1::2])
    def a(n): return sum(1 for b in range(2, n) if s(digits(n, b)[1:]) == 0)
    print([a(n) for n in range(1, 87)]) # Michael S. Branicky, May 24 2025
    

Formula

Trivial bounds: 1 <= a(n) <= n - 2 for n >= 3 because the representation of n in base n-1 is [1,1] and the alternating sum of digits of n is > 0 for bases >= n.

A100563 Number of bases less than sqrt(n) in which n is a palindrome.

Original entry on oeis.org

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

Views

Author

Gordon Hamilton, Nov 29 2004

Keywords

Comments

Is there a number m such that a(n) > 0 for all n > m? I call the set of numbers for which a(n)=0 "unkempt" for refusing to use a mirror in any base. Is there an infinite number of unkempt numbers? a(n) can be arbitrarily large.
The sequence A123586 gives the values of n where a(n)=0. - Robert G. Wilson v, Nov 01 2014
Is there a closed-form formula for this function? - Robert G. Wilson v, Nov 01 2014
From Robert G. Wilson v, Nov 26 2014: (Start)
The first occurrence, beginning at 0, of n is: 1, 5, 17, 65, 121, 562, 1432, 1477, 4369, 36582, 35101, 86677, 83161, 360361, 291721, 720721, 887041, 1496881, 1670761, 3931201, 3341521, 5654881, 7207201, 7761601,...
Positions where a(n)=k:
k = 0: A123586;
k = 1: 5, 7, 9, 10, 13, 15, 16, 20, 23, 25, 27, 28, 29, 33, 34, 36, 37, 38, 40, ...;
k = 2: 17, 21, 26, 31, 46, 51, 52, 55, 57, 63, 67, 73, 78, 80, 82, 91, 92, 93, 98, ...;
k = 3: 65, 85, 100, 130, 154, 164, 170, 178, 191, 195, 203, 209, 242, 282, 292, ...;
k = 4: 121, 235, 255, 257, 273, 300, 325, 341, 343, 373, 400, 495, 601, 610, 626, 666, ...;
k = 5: 562, 676, 771, 819, 1009, 1111, 1220, 1333, 1365, 1441, 1543, 1978, 1981, 2000, ...;
k = 6: 1432, 2380, 2666, 2925, 3280, 4035, 4095, 4161, 4225, 4401, 4525, 4561, 4681, ...;
k = 7: 1477, 4097, 4591, 7141, 7993, 8191, 9640, 10081, 10297, 10626, 10858, 11761, ...; etc.
(End)

Examples

			100 is a palindrome in bases 3, 7 and 9, so a(100) = 3.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Module[{p}, Table[ p = IntegerDigits[n, b]; If[p == Reverse@ p, {b, p}, Sequence @@ {}], {b, 2, Sqrt@ n}]]; Array[ Length@ f@# &, 105] (* Robert G. Wilson v, Nov 01 2014 *)
  • PARI
    a(n) = {my(nb = 0); for (b=2, sqrt(n), d = digits(n, b); nb+= (Vecrev(d) == d);); nb;} \\ Michel Marcus, Nov 05 2014

Formula

a(n) = A135551(n) - A033831(n). - Robert G. Wilson v, Nov 01 2014

Extensions

a(58) from Robert G. Wilson v, Nov 05 2014

A359113 a(n) counts the bases b in the interval 2 to p = prime(n), where p if written in base b gives again a prime number in base b if all digits are written in reverse order.

Original entry on oeis.org

0, 1, 3, 5, 7, 10, 12, 9, 14, 15, 20, 19, 23, 26, 24, 33, 22, 30, 38, 36, 40, 39, 38, 33, 54, 49, 43, 52, 37, 60, 65, 53, 59, 57, 50, 52, 85, 52, 79, 76, 57, 77, 69, 103, 90, 83, 84, 106, 80, 68, 90, 85, 89, 94, 75, 100, 108, 87, 128, 97, 119, 99, 118, 139, 105, 96
Offset: 1

Views

Author

Thomas Scheuerle, Jan 07 2023

Keywords

Comments

Let p' be p with digit reversal in base b. If p' is composite then all multiplication operations c * d = p' in base b of integers c,d > 1 are using carry in long multiplication. For A000040(n) this is the case in A000040(n) - (a(n)+1) bases.
If a(n) is a record in this sequence, then A000040(n) is in A331486.
Prime indices of numbers in A228768 are also among the indices of the records in the rational number sequence a(n)/(n-1) with n > 1. See also the plot of this sequence in the link section.

Examples

			a(3) = 3:
  prime(3) = 5 in bases 2..5:
  5 = 101_2; reversing digits gives 101_2 = 5 (prime).
  5 =  12_3; reversing digits gives  21_3 = 7 (prime).
  5 =  11_4; reversing digits gives  11_4 = 5 (prime).
  5 =  10_5; reversing digits gives  01_5 = 1 (nonprime).
		

Crossrefs

Programs

  • PARI
    revprime(p, b)=my(q, t=p); while(t, q=b*q+t%b; t\=b); isprime(q)
    a(n) = sum(b = 2, prime(n), revprime(prime(n), b))

Formula

a(n) >= A135551(A000040(n)).

A384436 a(n) is the number of distinct ways to represent n in any integer base >= 2 using only square digits.

Original entry on oeis.org

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

Views

Author

Felix Huber, May 29 2025

Keywords

Comments

The representations of n remain the same for bases greater than n, as they all consist solely of the digit n.

Examples

			The a(36) = 11 distinct ways to represent 36 using only square digits are [1,0,0,1,0,0] in base 2, [1,1,0,0] in base 3, [1,0,0] in base 6, [4,4] in base 8, [4,0] in base 9, [1,16] in base 20, [1,9] in base 27, [1,4] in base 32, [1,1] in base 35, [1,0] in base 36 and [36] in bases >= 37.
		

Crossrefs

Programs

  • Maple
    A384436:=proc(n)
        local a,b,c;
        a:=0;
        for b from 2 to n+1 do
            c:=convert(n,'base',b);
            if select(issqr,c)=c then
                a:=a+1
            fi
        od;
        return max(1,a)
    end proc;
    seq(A384436(n),n=0..81);
  • Mathematica
    a[n_] := Sum[Boole[AllTrue[IntegerDigits[n, b], IntegerQ[Sqrt[#]] &]], {b, 2, n+1}]; a[0] = 1; Array[a, 100, 0] (* Amiram Eldar, May 29 2025 *)
  • PARI
    a(n) = sum(b=2, n+1, my(d=digits(n,b)); #select(issquare, d) == #d); \\ Michel Marcus, May 29 2025

Formula

Trivial lower bound for n >= 2: a(n) >= 2 for nonsquares n and a(n) >= 3 for squares n because in base 2 the representations of n consists only of the square digits '0' and '1', in base n the representation of n is [1,0] and in bases > n the representation of n is [n].
Showing 1-9 of 9 results.