OFFSET
1,1
COMMENTS
For any prime p > 3, if p + 4 is prime then necessarily it is the next prime. But there cannot be three consecutive primes with mutual distance 4: If p and p + 4 are prime, then p+8 is an odd multiple of 3 (cf. formula). - M. F. Hasler, Jan 15 2013
The smaller members p of cousin prime pairs (p,p+4) excluding p=3. - Marc Morgenegg, Apr 19 2016
LINKS
Marius A. Burtea, Table of n, a(n) for n = 1..14741 ( first 1000 terms from R. Zumkeller )
FORMULA
a(n) = 1 (mod 6) for all n; (a(n) + 2)/3 = A157834(n), i.e., a(n) = 3*A157834(n) - 2. - M. F. Hasler, Jan 15 2013
EXAMPLE
79 is a term as the next prime is 79 + 4 = 83. 3 is not a term even though 3 + 4 = 7 is prime, since it is not the next one.
MAPLE
for i from 1 to 226 do if ithprime(i+1) = ithprime(i) + 4 then print({ithprime(i)}); fi; od; # Zerinvary Lajos, Mar 19 2007
MATHEMATICA
Select[Prime[Range[225]], NextPrime[#] == # + 4 &] (* Alonso del Arte, Jan 17 2013 *)
Transpose[Select[Partition[Prime[Range[300]], 2, 1], #[[2]]-#[[1]]==4&]] [[1]] (* Harvey P. Dale, Mar 28 2016 *)
PROG
(PARI) forprime(p=1, 1e4, if(nextprime(p+1)-p==4, print1(p, ", "))) \\ Felix Fröhlich, Aug 16 2014
(Magma) [p:p in PrimesUpTo(1700)| IsPrime(p+4) and NextPrime(p) eq p+4] // Marius A. Burtea, Jan 24 2019
(MATLAB)
p=primes(1700); m=1;
for u=1:length(p)-4
if and(isprime(p(u)+4)==1, p(u+1)==p(u)+4); sol(m)=p(u); m=m+1; end
end
sol % Marius A. Burtea, Jan 24 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved