%I #8 Jun 14 2025 00:20:25
%S 2,199,313,139,67,113,163,1583,23789,941,131,5351,26801,2693,4073,
%T 15859,4919,23209,176053,86783,29717,20849,151289,50111,51971,23689,
%U 11807,180337,563,25153,517381,36313,256121,753091,208441,28573,4049,108943,451361,114343,28447,21001,4001,3137,6833,885919
%N a(n) is the first prime p such that the concatenations of n consecutive primes, starting with p, in both forward and backward directions, are prime.
%H Robert Israel, <a href="/A384958/b384958.txt">Table of n, a(n) for n = 1..135</a>
%e a(4) = 139 because the four consecutive primes starting with 139 are 139, 149, 151, 157, both 139149151157 and 157151149139 are prime, and no smaller prime works.
%p rcat:= proc(L) local x,i;
%p x:= L[1];
%p for i from 2 to nops(L) do
%p x:= 10^(1+ilog10(x))*L[i] + x
%p od;
%p x
%p end proc:
%p fcat:= proc(L) local x,i;
%p x:= L[1];
%p for i from 2 to nops(L) do
%p x:= 10^(1+ilog10(L[i]))*x + L[i]
%p od;
%p x
%p end proc:
%p f:= proc(n) local L,i;
%p L:= [0,seq(ithprime(i),i=1..n-1)];
%p do
%p L:= [op(L[2..-1]),nextprime(L[-1])];
%p if isprime(fcat(L)) and isprime(rcat(L)) then return L[1] fi
%p od
%p end proc:
%p map(f, [$1..50]);
%Y Cf. A384953.
%K nonn,base
%O 1,1
%A _Robert Israel_, Jun 13 2025