Search: a016038 -id:a016038
|
|
A050813
|
|
Numbers n not palindromic in any base b, 2 <= b <= 10.
|
|
+10
10
|
|
|
19, 39, 47, 53, 58, 69, 75, 76, 79, 84, 87, 90, 94, 95, 96, 102, 103, 106, 108, 110, 115, 116, 120, 122, 132, 133, 134, 137, 139, 140, 143, 144, 147, 149, 152, 155, 158, 159, 163, 167, 168, 169, 174, 175, 176, 177, 179, 180, 183, 184, 187, 188, 193, 196, 198
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
n = -1; t = {}; While[Length[t] < 100, n++; If[Count[Table[s = IntegerDigits[n, m]; s == Reverse[s], {m, 2, 10}], True] == 0, AppendTo[t, n]]]; t (* T. D. Noe, Jul 18 2012 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A047811
|
|
Numbers n >= 4 that are not palindromic in any base b, 2 <= b <= n/2.
|
|
+10
9
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
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
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
Select[Range[4, 1500], And@@(#!=Reverse[#]&/@Table[IntegerDigits[#, b], {b, 2, #/2}])&] (* Harvey P. Dale, May 22 2013 *)
|
|
PROG
|
(PARI) is(n)=!for(b=2, n\2, Vecrev(d=digits(n, b))==d&&return)&&n>3 \\ M. F. Hasler, Sep 08 2015
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A065531
|
|
Number of palindromes in all base b representations for n, for 2<=b<=n.
|
|
+10
9
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,5
|
|
COMMENTS
|
a(1) = 1 by convention, which makes this sequence different from A135551.
|
|
LINKS
|
|
|
MATHEMATICA
|
palindromicBases[n_] := Module[{p}, Table[p = IntegerDigits[n, b]; If[ p == Reverse[p], {b, p}, Sequence @@ {}], {b, 2, n - 1}]]; Table[ Length[ palindromicBases[n]], {n, 105}] (* Robert G. Wilson v, May 12 2005 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A135549
|
|
Number of bases b, 1 < b < n-1, in which n is a palindrome.
|
|
+10
9
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,11
|
|
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.
|
|
LINKS
|
|
|
FORMULA
|
|
|
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 *)
|
|
CROSSREFS
|
Cf. A016038 (non-palindromic numbers in any base 1 < b < n-1)
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A050812
|
|
Number of times n is palindromic in bases b, 2 <= b <= 10.
|
|
+10
8
|
|
|
9, 9, 8, 8, 7, 7, 5, 5, 4, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 0, 2, 3, 1, 1, 2, 1, 2, 2, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 0, 3, 1, 1, 1, 1, 2, 2, 0, 1, 1, 2, 2, 2, 0, 1, 3, 1, 2, 0, 1, 1, 1, 1, 3, 1, 3, 1, 2, 1, 0, 1, 1, 1, 2, 1, 0, 0, 1, 2, 0, 3, 1, 2, 1, 0, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
LINKS
|
|
|
EXAMPLE
|
a(121) = 4 since 121_10, 171_8, 232_7 and 11111_3 are palindromes.
|
|
MATHEMATICA
|
Table[Count[Table[IntegerDigits[n, b], {b, 2, 10}], _?(#==Reverse[#]&)], {n, 0, 90}] (* Harvey P. Dale, Aug 18 2012 *)
|
|
PROG
|
(Python)
from sympy.ntheory.digits import digits
def ispal(n, b):
digs = digits(n, b)[1:]
return digs == digs[::-1]
def a(n): return sum(ispal(n, b) for b in range(2, 11))
(PARI) a(n) = sum(b=2, 10, my(d=digits(n, b)); d == Vecrev(d)); \\ Michel Marcus, Sep 09 2021
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A135551
|
|
Number of bases b, 1 < b < n, in which n is a palindrome.
|
|
+10
8
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,6
|
|
COMMENTS
|
Every integer n is a palindrome when expressed in unary, or in base n-1 (where it will be 11).
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
|
|
LINKS
|
John P. Linderman, Perl program [Use the command: BASEDELTA=0 palin.pl]
|
|
FORMULA
|
|
|
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 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A016026
|
|
Smallest base relative to which n is palindromic.
|
|
+10
7
|
|
|
2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 10, 5, 3, 6, 2, 3, 2, 5, 18, 3, 2, 10, 3, 5, 4, 3, 2, 3, 4, 9, 2, 7, 2, 4, 6, 5, 6, 4, 12, 3, 5, 4, 6, 10, 2, 4, 46, 7, 6, 7, 2, 3, 52, 8, 4, 3, 5, 28, 4, 9, 6, 5, 2, 7, 2, 10, 5, 3, 22, 9, 7, 5, 2, 6, 14, 18, 10, 5, 78, 3, 8, 3, 5, 11, 2, 6, 28, 5, 8, 14, 3, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
The terms are well defined since each number m > 2 is palindromic in base m - 1.
A number n > 6 is prime, if a(n) = n - 1.
Numbers m of the form m = q * p with q < p - 1, are palindromic in base p - 1, and therefore a(m) <= p.
Numbers m of the form m := j*(p^k - 1)/(p - 1), 1 <= j < p are palindromic in base p, and therefore: a(m) <= p.(End)
|
|
LINKS
|
|
|
FORMULA
|
a(A002113(n)) <= 10 for n > 1. (End)
To put Fischer's comments in words: if n > 3 is a strictly non-palindromic number (A016038), then a(n) = n - 1. If n > 1 is a binary palindrome (A006995), then a(n) = 2. And if n > 1 is a decimal palindrome, then a(n) <= 10. - Alonso del Arte, Sep 15 2017
|
|
EXAMPLE
|
n = 4 = 11_3 is palindromic in base 3, but not palindromic in base 2, hence a(4) = 3. [Typo corrected by Phil Ronan, May 22 2014]
n = 14 = 22_6 is palindromic in base 6, but not palindromic in any other base < 6, hence a(14) = 6.
|
|
MATHEMATICA
|
palQ[n_, b_] := Reverse[x = IntegerDigits[n, b]] == x; Table[base = 2; While[!palQ[n, base], base++]; base, {n, 92}] (* Jayanta Basu, Jul 26 2013 *)
|
|
PROG
|
(PARI) ispal(n, b) = my(d=digits(n, b)); d == Vecrev(d);
a(n) = my(b=2); while (! ispal(n, b), b++); b; \\ Michel Marcus, Sep 22 2017
(Python)
from itertools import count
from sympy.ntheory.factor_ import digits
def A016026(n): return next(b for b in count(2) if (s := digits(n, b)[1:])[:(t:=len(s)+1>>1)]==s[:-t-1:-1]) # Chai Wah Wu, Jan 17 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
|
|
10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Identical to (base 10) non-palindromic numbers A029742 up to a(83) = 101 which is a term of this sequence but not in A029742. - M. F. Hasler, Sep 08 2015
|
|
LINKS
|
E. W. Weisstein, Repdigit, World of Mathematics, wolfram.com.
|
|
FORMULA
|
|
|
MAPLE
|
isA139819 := proc(n)
convert(n, base, 10) ;
convert(%, set) ;
simplify(nops(%) >1 ) ;
|
|
PROG
|
(Haskell) a139819 n = a139819_list !! (n-1)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A123586
|
|
Numbers that are not palindromes of 3 or more digits in some base b >= 2.
|
|
+10
4
|
|
|
1, 2, 3, 4, 6, 8, 11, 12, 14, 18, 19, 22, 24, 30, 32, 35, 39, 44, 47, 48, 53, 54, 58, 60, 66, 69, 70, 75, 76, 77, 79, 84, 87, 90, 94, 95, 96, 102, 103, 106, 108, 110, 115, 116, 120, 132, 134, 137, 139, 140, 143, 147, 149, 152, 158, 159, 163, 167, 168, 174, 175, 176
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A126071
|
|
Number of bases (2 <= b <= n+1) in which n is a palindrome.
|
|
+10
4
|
|
|
1, 1, 2, 2, 3, 2, 3, 3, 3, 4, 2, 3, 3, 3, 4, 4, 4, 4, 2, 4, 5, 3, 3, 5, 3, 5, 4, 5, 3, 4, 4, 4, 4, 4, 3, 6, 3, 4, 3, 6, 3, 5, 3, 4, 5, 5, 2, 6, 3, 5, 5, 6, 2, 5, 5, 5, 5, 3, 3, 7, 3, 4, 6, 5, 6, 5, 4, 5, 3, 5, 3, 7, 4, 4, 4, 4, 3, 7, 2, 8, 4, 5, 3, 7, 6, 4, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
a(n) >= 1, since n will always have a single "digit" in base n+1.
|
|
LINKS
|
|
|
EXAMPLE
|
From bases 2 to 9 respectively, 8 can be represented as: 1000, 22, 20, 13, 12, 11, 10, 8. Three of those are symmetrical (22, 11, 8) and so a(8) = 3.
|
|
MATHEMATICA
|
Table[cnt = 0; Do[d = IntegerDigits[n, k]; If[d == Reverse[d], cnt++], {k, 2, n + 1}]; cnt, {n, 100}] (* T. D. Noe, Oct 04 2012 *)
|
|
PROG
|
(PARI) a(n) = sum(k=2, n+1, d = digits(n, k); Vecrev(d) == d); \\ Michel Marcus, Mar 07 2015
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.016 seconds
|