login
Prime numbers Q such that the concatenation Q,7,Q is prime.
3

%I #22 Sep 08 2022 08:46:10

%S 3,131,137,149,167,191,233,269,359,389,443,467,563,587,593,599,617,

%T 683,701,743,797,839,947,1049,1097,1109,1163,1187,1277,1283,1319,1409,

%U 1433,1451,1553,1607,1871,1889,1901,1913,2111,2141

%N Prime numbers Q such that the concatenation Q,7,Q is prime.

%H Pierre CAMI, <a href="/A249379/b249379.txt">Table of n, a(n) for n = 1..10000</a>

%e 373 is prime so a(1)=3.

%p q:= n-> isprime(parse(cat(n, 7, n))):

%p select(q, [ithprime(i)$i=1..500])[]; # _Alois P. Heinz_, Jun 17 2021

%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)+7*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), 7), Str(p)))), print1(p, ", ")););} \\ _Michel Marcus_, Oct 27 2014

%o (Magma) [p: p in PrimesUpTo(3000) | IsPrime(Seqint(Intseq(p) cat [7] cat Intseq(p)))]; // _Vincenzo Librandi_, Oct 27 2014

%Y Cf. similar sequences listed in A249374.

%K nonn,base

%O 1,1

%A _Pierre CAMI_, Oct 27 2014