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

%I #22 Aug 14 2017 15:13:10

%S 7,9,21,39,53,57,61,63,67,69,139,149,161,163,173,187,189,201,207,219,

%T 233,247,259,269,273,279,291,293,299,301,347,363,413,447,451,453,467,

%U 473,481,511,531,537,539,549,583,609,623,629,633,637,649,663,691,697

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

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

%e 39 is included because 1393939 is a prime.

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

%t c13nQ[n_]:=PrimeQ[FromDigits[PadRight[{1},3 IntegerLength[n]+1,RotateRight[ IntegerDigits[n]]]]]; Select[Range[700],c13nQ] (* _Harvey P. Dale_, Aug 14 2017 *)

%o (Python)

%o from sympy import isprime

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

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

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

%o # _Derek Orr_, Aug 17 2014

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

%Y Cf. A242987, A242989, A242990.

%K nonn,base,easy

%O 1,1

%A _Harvey P. Dale_, Aug 17 2014