login
Primes p such that the concatenation p123456789 is prime.
2

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

%S 41,59,179,193,241,409,439,613,653,661,719,739,787,853,881,887,997,

%T 1091,1103,1129,1181,1213,1381,1409,1459,1487,1489,1571,1579,1669,

%U 1741,1801,1823,1861,1871,1879,1889,1907,1913,1993,2039,2083,2099,2243,2417,2593,2659,2663,2729,2741,2833,3079,3119

%N Primes p such that the concatenation p123456789 is prime.

%C Primes in A232727.

%H Harvey P. Dale, <a href="/A232728/b232728.txt">Table of n, a(n) for n = 1..1000</a>

%e 59 is a member of this sequence because 59 is prime and 59123456789 is prime.

%t With[{r=Range[1, 9]}, Select[Prime[Range[500]], PrimeQ[FromDigits[Join[IntegerDigits[#], r]]]&]] (* _Vincenzo Librandi_, Apr 28 2015 *)

%t Select[Prime[Range[500]],PrimeQ[#*10^9+123456789]&] (* _Harvey P. Dale_, Apr 01 2018 *)

%o (Python)

%o from sympy import prime,isprime

%o {print(prime(n),end=', ') for n in range(1,10**3) if isprime(int(str(prime(n))+'123456789'))}

%o ## Simplified by _Derek Orr_, Apr 28 2015

%o (PARI) forprime(p=1,10^4,if(isprime(eval(concat(Str(p),"123456789"))),print1(p,", "))) \\ _Derek Orr_, Apr 28 2015

%o (Magma) [p: p in PrimesUpTo(5000) | IsPrime(Seqint(Intseq(123456789) cat Intseq(p)))]; // _Vincenzo Librandi_, Apr 28 2015

%Y Cf. A232727, A104914, A104915.

%K nonn,base,easy

%O 1,1

%A _Derek Orr_, Nov 29 2013

%E More terms from _Derek Orr_, Apr 28 2015