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.
2, 3, 31, 443, 23053, 86677, 11827763, 27362989, 755827199, 1306369439
Offset: 0
Examples
a(5) = 86677, as it is palindromic in base 2, 107, 113, 151, and 233, and no smaller number satisfies the property.
Programs
-
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
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
Comments