login
A372142
a(n) is the smallest prime p such that there exist exactly n distinct primes q where q < p and the representation of p in base q is a palindrome.
1
2, 3, 31, 443, 23053, 86677, 11827763, 27362989, 755827199, 1306369439
OFFSET
0,1
COMMENTS
This is a special case of A372141.
It need not be the case that a(n) is a palindrome in base 2, as 23053 is a counterexample.
For p > 3, one only needs to check q such that q^2 + 1 <= p else p = cc_q = c*(q+1), not prime for c != 1 and q != 2. A similar argument shows that p cannot have an even number of digits in base q, else it would be divisible by (q+1). - Michael S. Branicky, Apr 21 2024
EXAMPLE
a(5) = 86677, as it is palindromic in base 2, 107, 113, 151, and 233, and no smaller number satisfies the property.
PROG
(Python)
from math import isqrt
from sympy import sieve
from sympy.ntheory import digits
from itertools import islice
def ispal(v): return v == v[::-1]
def f(p): return sum(1 for q in sieve.primerange(1, isqrt(p-1)+1) if ispal(digits(p, q)[1:]))
def agen():
adict, n = {0:2, 1:3}, 0
for p in sieve:
v = f(p)
if v >= n and v not in adict:
adict[v] = p
while n in adict:
yield adict[n]; del adict[n]; n += 1
print(list(islice(agen(), 6))) # Michael S. Branicky, Apr 21 2024
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Tadayoshi Kamegai, Apr 21 2024
EXTENSIONS
a(6) from Jon E. Schoenfield, Apr 21 2024
a(7) from Michael S. Branicky, Apr 21 2024
a(8) from Michael S. Branicky, Apr 22 2024
a(9) from Michael S. Branicky, Apr 24 2024
STATUS
approved