login
Primes p such that p+2, p+222 and p+2222 are also prime.
4

%I #5 Apr 23 2014 16:05:15

%S 17,29,59,71,281,461,827,1151,1277,1289,1487,1667,1877,1931,2687,2789,

%T 2801,3359,3557,3851,4049,4229,4259,4481,4649,5417,5519,5657,5867,

%U 5879,6089,6131,6299,6359,6779,6791,7127,7211,8291,8837,9719,10067,10937,13397,13679

%N Primes p such that p+2, p+222 and p+2222 are also prime.

%C All the terms in the sequence are congruent to 2 mod 3.

%C The constants in the definition (2, 222 and 2222) are the concatenation of digit 2.

%H K. D. Bajpai, <a href="/A241485/b241485.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 17 is a prime: 17+2 = 19, 17+222 = 239 and 17+2222 = 2239 are also prime.

%e a(2) = 29 is a prime: 29+2 = 31, 29+222 = 251 and 29+2222 = 2251 are also prime.

%p KD:= proc() local a,b,d,e; a:= ithprime(n); b:=a+2;d:=a+222;e:=a+2222; if isprime(b)and isprime(d)and isprime(e) then return (a) :fi; end: seq(KD(), n=1..5000);

%t KD={}; Do[p=Prime[n];If[PrimeQ[p+2]&&PrimeQ[p+222]&&PrimeQ[p+2222], AppendTo[KD,p]], {n,5000}]; KD

%t (*For b-file*) c=0;p=Prime[n];Do[If[PrimeQ[p+2]&&PrimeQ[p+222]&&PrimeQ[p+2222],c=c+1; Print[c," ",p]],{n,1,3*10^6}];

%Y Cf. A000040, A023200, A046136, A230223, A236302, A237890.

%K nonn

%O 1,1

%A _K. D. Bajpai_, Apr 23 2014