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.

A016026 Smallest base relative to which n is palindromic.

Original entry on oeis.org

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

Views

Author

Keywords

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)

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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

Formula

From Hieronymus Fischer, Jan 05 2014: (Start)
a(A016038(n)) = A016038(n) - 1, for n > 3.
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