%I #24 Sep 08 2022 08:46:10
%S 3,7,13,31,37,43,61,67,79,163,277,313,331,433,439,487,523,541,607,619,
%T 643,733,769,907,937,991,1033,1051,1213,1291,1303,1321,1381,1423,1459,
%U 1489,1597,1699,1741,1759,1831,1867
%N Prime numbers Q such that the concatenation Q,5,Q is prime.
%H Pierre CAMI, <a href="/A249378/b249378.txt">Table of n, a(n) for n = 1..10000</a>
%e 353 is prime so a(1)=3.
%e 555 is composite, 757 is prime, so a(2)=7.
%t q5Q[n_]:=PrimeQ[FromDigits[Join[IntegerDigits[n],{5},IntegerDigits[n]]]]; Select[Prime[Range[300]],q5Q] (* _Harvey P. Dale_, Jul 21 2020 *)
%o (PFGW & SCRIPT), the pre10.txt file with the first 10000000 prime numbers.
%o SCRIPT
%o DIM i,0
%o DIM j
%o DIM k
%o DIM n,1
%o OPENFILEOUT myf,a(n).txt
%o OPENFILEIN maf,pre10.txt
%o GETNEXT j,maf
%o LABEL loop1
%o GETNEXT j,maf
%o IF j>10^n THEN SET n,n+1
%o SET k,j*10^(n+1)+5*10^n+j
%o PRP k
%o IF ISPRP THEN GOTO w
%o GOTO loop1
%o LABEL w
%o SET i,i+1
%o WRITE myf,j
%o IF i>9999 THEN END
%o GOTO loop1
%o (PARI) lista(nn) = {forprime(p=1, nn, if (isprime(eval(concat(concat(Str(p), 5), Str(p)))), print1(p, ", ")););} \\ _Michel Marcus_, Oct 27 2014
%o (Magma) [p: p in PrimesUpTo(3000) | IsPrime(Seqint(Intseq(p) cat [5] cat Intseq(p)))]; // _Vincenzo Librandi_, Oct 27 2014
%Y Cf. similar sequences listed in A249374.
%K nonn
%O 1,1
%A _Pierre CAMI_, Oct 27 2014
|