login
A086757
Smallest prime p such that n is a palindrome in base-p representation.
2
2, 3, 2, 3, 2, 5, 2, 3, 2, 3, 13, 5, 3, 13, 2, 3, 2, 5, 23, 3, 2, 23, 3, 5, 29, 3, 2, 3, 31, 29, 2, 7, 2, 37, 37, 5, 41, 37, 41, 3, 5, 13, 47, 43, 2, 5, 53, 7, 53, 7, 2, 3, 59, 17, 59, 3, 5, 59, 61, 11, 67, 5, 2, 7, 2, 67, 5, 3, 71, 13, 7, 5, 2, 73, 79, 37, 79, 5, 83, 3, 83, 3, 5, 11, 2
OFFSET
1,1
COMMENTS
A016026(n) <= a(n) <= A007918(n).
PROG
(Python)
from sympy import sieve
from sympy.ntheory import is_palindromic
def a086757(n): return next(p for p in sieve if is_palindromic(n, p)) # Dumitru Damian, Jan 29 2024
(PARI) isok(p, n) = my(d=digits(n, p)); d == Vecrev(d);
a(n) = my(p=2); while (!isok(p, n), p=nextprime(p+1)); p; \\ Michel Marcus, Jan 30 2024
CROSSREFS
Cf. A006995 (a(n)=2).
Sequence in context: A112048 A060395 A016026 * A369690 A166985 A046215
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Aug 01 2003
STATUS
approved