(MAGMA)
//Program finds primes separated by an even number (called gap) which
//have a power of two between them. The program starts with the smallest
//of two above gap. Primes less than this starting point can be checked by
//inspection. In this example 3 also works.
gap:=4;
start:=Ilog2(gap)+1;
for i:= start to 1000 do
powerof2:=2^i;
for k:=powerof2gap+1 to powerof21 by 2 do
if (IsPrime(k) and IsPrime(k+gap)) then k;
end if;
end for;
end for;
(MAGMA) [n: n in PrimesUpTo(10^3)  IsPrime(n+4) and exists{t: t in [n+1..n+3 by 2]  IsOne(t/2^Valuation(t, 2))}]; // Bruno Berselli, May 16 2013
