login
A253594
Numbers n that have more than one palindromic representation in bases 2 <= b <= n-2.
5
10, 15, 16, 17, 18, 20, 21, 24, 26, 27, 28, 30, 31, 32, 33, 34, 36, 38, 40, 42, 44, 45, 46, 48, 50, 51, 52, 54, 55, 56, 57, 60, 62, 63, 64, 65, 66, 67, 68, 70, 72, 73, 74, 75, 76, 78, 80, 81, 82, 84, 85, 86, 88, 90, 91, 92, 93, 96, 98, 99, 100, 102, 104, 105, 107, 108, 109, 110, 111, 112, 114, 116, 117, 118, 119, 120, 121, 122, 123, 124
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.
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
Sequence in context: A074391 A324527 A164865 * A330698 A342593 A046424
KEYWORD
nonn,base,easy
AUTHOR
Christian Perfect, Jan 05 2015
STATUS
approved