login
Primes preceding gaps divisible by 4.
6

%I #26 Jan 26 2023 15:28:42

%S 7,13,19,37,43,67,79,89,97,103,109,127,163,193,199,211,223,229,277,

%T 307,313,349,359,379,389,397,401,439,449,457,463,467,479,487,491,499,

%U 509,613,619,643,661,673,683,701,719,739,743,757,761,769,797,823,853,859

%N Primes preceding gaps divisible by 4.

%C Prime complement of A098058. - _Robert G. Wilson v_, Jul 17 2015

%H Robert Israel, <a href="/A098059/b098059.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) ~ 2n log n. - _Charles R Greathouse IV_, Jun 29 2015

%e 7 is a term since the next prime after 7 is 11 and 11-7 is divisible by 4.

%p N:= 1000: # to get all terms up to the second-last prime <= N

%p Primes:= select(isprime,[2, 2*i+1 $ i=1..floor((N-1)/2)]):

%p Gaps:= Primes[2..-1] - Primes[1..-2]:

%p Primes[select(t-> Gaps[t] mod 4 = 0, [$1..nops(Gaps)])]; # _Robert Israel_, Jun 24 2015

%t Prime[Select[Range[150], Mod[Prime[ # + 1] - Prime[ # ], 4] == 0 &]] (* _Ray Chandler_, Oct 26 2006 *)

%t Transpose[Select[Partition[Prime[Range[200]],2,1],Divisible[Last[#]- First[#], 4]&]][[1]] (* _Harvey P. Dale_, Apr 06 2013 *)

%o (PARI) f(n) = for(x=1,n,z=(prime(x+1)-prime(x));if(z%4==0,print1(prime(x)",")))

%o (PARI) p=2; forprime(q=3,1e4, if((q-p)%4==0, print1(p", ")); p=q) \\ _Charles R Greathouse IV_, Jun 29 2015

%Y Subsequence of A152087.

%Y Cf. A001223, A098058.

%K easy,nonn

%O 1,1

%A _Cino Hilliard_, Sep 11 2004

%E Edited by _Ray Chandler_, Oct 26 2006

%E New name from _Robert Israel_ and _Charles R Greathouse IV_, Jun 29 2015