login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A086757 Smallest prime p such that n is a palindrome in base-p representation. 2

%I #27 Feb 13 2024 14:34:34

%S 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,

%T 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,

%U 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

%N Smallest prime p such that n is a palindrome in base-p representation.

%C A016026(n) <= a(n) <= A007918(n).

%o (Python)

%o from sympy import sieve

%o from sympy.ntheory import is_palindromic

%o def a086757(n): return next(p for p in sieve if is_palindromic(n, p)) # _Dumitru Damian_, Jan 29 2024

%o (PARI) isok(p,n) = my(d=digits(n,p)); d == Vecrev(d);

%o a(n) = my(p=2); while (!isok(p,n), p=nextprime(p+1)); p; \\ _Michel Marcus_, Jan 30 2024

%Y Cf. A007918, A016026.

%Y Cf. A006995 (a(n)=2).

%K nonn,base

%O 1,1

%A _Reinhard Zumkeller_, Aug 01 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 14:23 EDT 2024. Contains 371960 sequences. (Running on oeis4.)