OFFSET
1,1
COMMENTS
We do not include base n-1, because every n>2 is written '11' in base n-1.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1685 from Christian Perfect)
EXAMPLE
10 is written '101' in base 3, and '22' in base 4.
12 is written '22' in base 5, but is not a palindrome in any other base up to 10, so does not belong to this sequence.
MATHEMATICA
palbQ[b_, n_]:=With[{idb=IntegerDigits[n, b]}, idb==Reverse[idb]]; Select[Range[150], Total[Boole[Table[palbQ[b, #], {b, 2, #-2}]]]>1&] (* Harvey P. Dale, Aug 20 2025 *)
PROG
(Python)
from itertools import count
def base(n, b):
while n:
m = n%b
yield m
n = (n-m)//b
def is_palindrome(seq):
seq = list(seq)
l = len(seq)//2
return seq[:l] == seq[-1:-l-1:-1]
def a():
for n in count(2):
base_representations = [(b, list(base(n, b))) for b in range(2, n-1)]
pals = [(b, s) for b, s in base_representations if is_palindrome(s)]
if len(pals)>1:
yield n
(Python)
from sympy.ntheory import digits
def ok(n):
c = 0
for b in range(2, n-1):
d = digits(n, b)[1:]
c += int(d == d[::-1])
if c == 2: return True
return c > 1
print([k for k in range(125) if ok(k)]) # Michael S. Branicky, Feb 05 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Christian Perfect, Jan 05 2015
STATUS
approved
