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!)
A186698 Next prime after n-th positive palindrome. 2
2, 3, 5, 5, 7, 7, 11, 11, 11, 13, 23, 37, 47, 59, 67, 79, 89, 101, 103, 113, 127, 137, 149, 157, 163, 173, 191, 193, 211, 223, 223, 233, 251, 257, 263, 277, 283, 293, 307, 317, 331, 337, 347, 359, 367, 379, 389, 397, 409, 419, 431, 439, 449, 457, 467, 479, 487, 499, 509, 521, 541, 541, 547, 557, 569, 577, 587, 599, 607, 617, 631, 641, 647 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
There are infinitely many n for which a(n+1) = a(n). For example, when 10^k + 1 is composite, 10^k - 1 and 10^k + 1 are successive palindromes which have the same next prime. - Robert Israel, Nov 04 2015
LINKS
FORMULA
a(n) = A151800(A002113(n+1)). - Michael S. Branicky, Jul 10 2024
MAPLE
digrev:= proc(x) option remember; local t;
t:= x mod 10;
t*10^ilog10(x)+procname((x-t)/10)
end proc:
for x from 0 to 9 do digrev(x):= x od:
N:=6;
Pals:= $1..9:
for d from 2 to N do
if d::even then
m:= d/2;
Pals:= Pals, seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1);
else
m:= (d-1)/2;
Pals:= Pals, seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1);
fi
od:
Pals:=[Pals]:
map(nextprime, Pals); # Robert Israel, Nov 04 2015
MATHEMATICA
NextPrime[Select[Range[700], PalindromeQ]] (* Harvey P. Dale, Jan 31 2024 *)
PROG
(Python)
from sympy import nextprime
def A186698(n): return int(nextprime((c:=n+1-x)*x+int(str(c)[-2::-1] or 0) if n+1<(x:=10**(len(str(n+1>>1))-1))+(y:=10*x) else (c:=n+1-y)*y+int(str(c)[::-1] or 0))) # Chai Wah Wu, Jul 10 2024
CROSSREFS
Sequence in context: A159477 A268101 A123318 * A234345 A111060 A082432
KEYWORD
nonn,base
AUTHOR
Harvey P. Dale, Feb 25 2011
STATUS
approved

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 September 18 01:28 EDT 2024. Contains 375995 sequences. (Running on oeis4.)