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!)
A249374 Prime numbers Q such that the concatenation Q,1,Q is prime. 11

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

%S 3,17,29,41,47,59,71,89,113,131,137,239,263,359,389,443,461,467,509,

%T 653,659,821,887,911,947,971,977,1151,1193,1223,1499,1553,1559,1613,

%U 1637,1667,1787,1871,1997,2039,2063,2081,2141,2243,2267,2273,2297,2351,2393,2399

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

%C Primes in A103967, similar sequence without restriction on Q. - _Michel Marcus_, Oct 27 2014

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

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

%e 515, 717, 11111 and 13113 are all composite, 17117 is prime so a(2) = 17.

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

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

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

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

%o (Python)

%o from sympy import isprime, primerange

%o def ok(p): s = str(p); return isprime(int(s+'1'+s))

%o print(list(filter(ok, primerange(1, 2400)))) # _Michael S. Branicky_, Jun 17 2021

%Y Cf. similar sequences with concatenation Q,k,Q: this sequence (k=1), A249375 (k=2), A249376 (k=3), A249377 (k=4), A249378 (k=5), A249350 (k=6), A249379 (k=7), A249380 (k=8), A249381 (k=9).

%K nonn,base

%O 1,1

%A _Pierre CAMI_, Oct 27 2014

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 7 04:49 EDT 2024. Contains 375729 sequences. (Running on oeis4.)