This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A384958 #8 Jun 14 2025 00:20:25 %S A384958 2,199,313,139,67,113,163,1583,23789,941,131,5351,26801,2693,4073, %T A384958 15859,4919,23209,176053,86783,29717,20849,151289,50111,51971,23689, %U A384958 11807,180337,563,25153,517381,36313,256121,753091,208441,28573,4049,108943,451361,114343,28447,21001,4001,3137,6833,885919 %N A384958 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 A384958 Robert Israel, <a href="/A384958/b384958.txt">Table of n, a(n) for n = 1..135</a> %e A384958 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 A384958 rcat:= proc(L) local x,i; %p A384958 x:= L[1]; %p A384958 for i from 2 to nops(L) do %p A384958 x:= 10^(1+ilog10(x))*L[i] + x %p A384958 od; %p A384958 x %p A384958 end proc: %p A384958 fcat:= proc(L) local x,i; %p A384958 x:= L[1]; %p A384958 for i from 2 to nops(L) do %p A384958 x:= 10^(1+ilog10(L[i]))*x + L[i] %p A384958 od; %p A384958 x %p A384958 end proc: %p A384958 f:= proc(n) local L,i; %p A384958 L:= [0,seq(ithprime(i),i=1..n-1)]; %p A384958 do %p A384958 L:= [op(L[2..-1]),nextprime(L[-1])]; %p A384958 if isprime(fcat(L)) and isprime(rcat(L)) then return L[1] fi %p A384958 od %p A384958 end proc: %p A384958 map(f, [$1..50]); %Y A384958 Cf. A384953. %K A384958 nonn,base %O A384958 1,1 %A A384958 _Robert Israel_, Jun 13 2025