login
A249374
Prime numbers Q such that the concatenation Q,1,Q is prime.
11
3, 17, 29, 41, 47, 59, 71, 89, 113, 131, 137, 239, 263, 359, 389, 443, 461, 467, 509, 653, 659, 821, 887, 911, 947, 971, 977, 1151, 1193, 1223, 1499, 1553, 1559, 1613, 1637, 1667, 1787, 1871, 1997, 2039, 2063, 2081, 2141, 2243, 2267, 2273, 2297, 2351, 2393, 2399
OFFSET
1,1
COMMENTS
Primes in A103967, similar sequence without restriction on Q. - Michel Marcus, Oct 27 2014
EXAMPLE
313 is prime so a(1) = 3.
515, 717, 11111 and 13113 are all composite, 17117 is prime so a(2) = 17.
MAPLE
q:= n-> isprime(parse(cat(n, 1, n))):
select(q, [ithprime(i)$i=1..500])[]; # Alois P. Heinz, Jun 17 2021
PROG
(PFGW & SCRIPT), pre10.txt file with the first 10000000 prime numbers.
SCRIPT
DIM i, 0
DIM j
DIM k
DIM n, 1
OPENFILEOUT myf, a(n).txt
OPENFILEIN maf, pre10.txt
GETNEXT j, maf
LABEL loop1
GETNEXT j, maf
IF j>10^n THEN SET n, n+1
SET k, j*10^(n+1)+10^n+j
PRP k
IF ISPRP THEN GOTO w
GOTO loop1
LABEL w
SET i, i+1
WRITE myf, j
IF i>9999 THEN END
GOTO loop1
(PARI) lista(nn) = {forprime(p=1, nn, if (isprime(eval(concat(concat(Str(p), 1), Str(p)))), print1(p, ", ")); ); } \\ Michel Marcus, Oct 27 2014
(Magma) [p: p in PrimesUpTo(3000) | IsPrime(Seqint(Intseq(p) cat [1] cat Intseq(p)))]; // Vincenzo Librandi, Oct 27 2014
(Python)
from sympy import isprime, primerange
def ok(p): s = str(p); return isprime(int(s+'1'+s))
print(list(filter(ok, primerange(1, 2400)))) # Michael S. Branicky, Jun 17 2021
CROSSREFS
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).
Sequence in context: A167806 A007348 A105912 * A106085 A172487 A007490
KEYWORD
nonn,base
AUTHOR
Pierre CAMI, Oct 27 2014
STATUS
approved