OFFSET
1,1
COMMENTS
From Hieronymus Fischer, Jan 05 2014: (Start)
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
Hieronymus Fischer, Table of n, a(n) for n = 1..10000 (first 1000 from Vincenzo Librandi).
K. S. Brown, On General Palindromic Numbers
FORMULA
From Hieronymus Fischer, Jan 05 2014: (Start)
a(A006995(n)) = 2, for n > 1.
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