login
Primes p such that p+12, p+1234 and p+123456 are also prime.
4

%I #11 Apr 23 2014 16:07:39

%S 127,907,3037,3457,5737,7057,11047,15427,15667,21517,24697,30307,

%T 38287,38317,39607,40177,46477,47797,48787,51157,52177,57667,65587,

%U 70627,70867,71887,72997,74857,75277,80317,99817,100447,103657,106747,128437,130087,132157

%N Primes p such that p+12, p+1234 and p+123456 are also prime.

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

%C The constants in the definition (12, 1234 and 123456) are the concatenation of digits 1,2,3,4,5 and 6.

%H K. D. Bajpai, <a href="/A236304/b236304.txt">Table of n, a(n) for n = 1..5077</a>

%e a(1) = 127 is a prime: 127+12 = 139, 127+1234 = 1361 and 127+123456 = 123583 are also prime.

%e a(2) = 907 is a prime: 907+12 = 919, 907+1234 = 2141 and 907+123456 = 124363 are also prime.

%p KD:= proc() local a,b,d,e; a:= ithprime(n); b:=a+12;d:=a+1234;e:=a+123456; if isprime(b)and isprime(d)and isprime(e) then return (a) :fi; end: seq(KD(), n=1..15000);

%t KD={}; Do[p=Prime[n]; If[PrimeQ[p+12]&&PrimeQ[p+1234]&&PrimeQ[p+123456], AppendTo[KD,p]], {n,15000}];KD

%t c=0; p=Prime[n]; Do[If[PrimeQ[p+12]&&PrimeQ[p+1234]&&PrimeQ[p+123456], c=c+1; Print[c," ",p]],{n,1,5*10^6}];(*b-file*)

%o (PARI) s=[]; forprime(p=2, 140000, if(isprime(p+12) && isprime(p+1234) && isprime(p+123456), s=concat(s, p))); s \\ _Colin Barker_, Apr 22 2014

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

%K nonn

%O 1,1

%A _K. D. Bajpai_, Apr 21 2014