[go: up one dir, main page]

login
A249376
Prime numbers Q such that the concatenation Q,3,Q is prime.
3
11, 13, 17, 19, 37, 41, 53, 59, 79, 83, 97, 109, 127, 137, 151, 167, 179, 197, 211, 223, 241, 263, 283, 349, 367, 409, 461, 463, 503, 509, 523, 577, 587, 593, 599, 643, 739, 769, 787, 809, 827, 829, 853, 967, 977, 1049
OFFSET
1,1
EXAMPLE
333 is composite, 535 is composite, 737 is composite, 11311 is prime so a(1)=11.
PROG
(PFGW & SCRIPT), the 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)+3*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), 3), Str(p)))), print1(p, ", ")); ); } \\ Michel Marcus, Oct 27 2014
(Magma) [p: p in PrimesUpTo(3000) | IsPrime(Seqint(Intseq(p) cat [3] cat Intseq(p)))]; // Vincenzo Librandi, Oct 27 2014
(Python)
from sympy import isprime, primerange
def ok(p): s = str(p); return isprime(int(s + "3" + s))
def aupton(limit): return [p for p in primerange(1, limit+1) if ok(p)]
print(aupton(1050)) # Michael S. Branicky, Nov 13 2021
CROSSREFS
Cf. similar sequences listed in A249374.
Sequence in context: A164329 A159236 A215417 * A068155 A271367 A226217
KEYWORD
nonn,base
AUTHOR
Pierre CAMI, Oct 27 2014
STATUS
approved