login
Numbers n such that concatenating 1 with four instances of n produces a prime.
4

%I #19 Aug 19 2014 00:51:34

%S 37,39,49,73,97,123,139,159,211,213,219,253,273,291,313,327,337,339,

%T 369,399,409,477,481,511,529,531,579,589,607,633,643,663,697,717,723,

%U 733,753,787,789,819,831,841,891,909,919,967,987,1041,1117,1131,1281,1377

%N Numbers n such that concatenating 1 with four instances of n produces a prime.

%H Jens Kruse Andersen, <a href="/A242989/b242989.txt">Table of n, a(n) for n = 1..10000</a>

%e 159 is included because 1159159159159 is a prime.

%t cQ[n_,i_]:=Module[{idn=IntegerDigits[n]},PrimeQ[FromDigits[Flatten[ Join[ {1},Table[ idn,{i}]]]]]]; Select[Range[2000],cQ[#,4]&]

%o (Python)

%o from sympy import isprime

%o for n in range(10**3):

%o ..if isprime('1'+4*str(n)):

%o ....print(n,end=', ')

%o # _Derek Orr_, Aug 17 2014

%o (PARI) s=[]; for(n=1, 10^4, d=length(Str(n)); if(isprime(10^(4*d)+(10^(4*d)-1)/(10^d-1)*n), s=concat(s, n))); s \\ _Jens Kruse Andersen_, Aug 18 2014

%Y Cf. A242987, A242988, A242990.

%K nonn,base,easy

%O 1,1

%A _Harvey P. Dale_, Aug 17 2014