%I #23 Jan 21 2020 10:11:50
%S 0,5,0,0,137,0,0,1931,0,0,9437,0,0,2969,0,0,20441,0,0,62987,0,0,
%T 510401,0,0,48677,0,0,677471,0,0,997811,0,0,173357,0,0,1134311,0,0,
%U 3063287,0,0,3591191,0,0,4876511,0,0,838247,0,0,4297091,0,0,15492437,0,0,27458747
%N a(n) = p is the smallest prime introducing a consecutive prime-difference pattern as follows: [2,2n,2], i.e., [p, p+2, p+2+2n, p+2+2n+2] are consecutive primes. Increasing middle prime gap in the immediate neighborhood of two small gaps(=2); a(n) = 0 if no such pattern exists.
%C It is conjectured that the twin primes in the neighborhood can be separated by an arbitrarily large gap.
%H Amiram Eldar, <a href="/A082512/b082512.txt">Table of n, a(n) for n = 1..225</a>
%F a(n) = 0 if n != 2 (mod 3). - _Amiram Eldar_, Jan 21 2020
%e a(4) = 0 because no p can begin a [2,8,2] gap pattern since p mod 6 = 5 must hold and following 3 primes give modulo 6 residues 1, 3, and 5, so p + 2 + 8 is not prime; a(n)=0 if 2n congruent to 0 or 2 mod 6; a(n) has solution for n = 6k + 4;
%e For n=16, the 4 corresponding primes and 3 differences are {1931 [2] 1933 [16] 1949 [2] 1951}.
%t d[x_] := Prime[x+1]-Prime[x]; h={k1=2, k2=82, k3=2}; de=Apply[Plus, h]; k=0; Do[If[Equal[d[n], k1]&&Equal[d[n+1], k2]&&Equal[d[n+2], k3], k=k+1; Print[k, n, h, {Prime[n], Prime[n+1], Prime[n+2], Prime[n+3]}]], {n, 1, 10000000}]
%t max = 20; v = Table[0, {max}]; p = Prime /@ Range[4]; count = 0; While[count < max, If[p[[2]] == p[[1]] + 2 && p[[4]] == p[[3]] + 2, d = ((p[[3]] - p[[2]])/2 - 2)/3 + 1; If[d <= max && v[[d]]==0, count++; v[[d]] = p[[1]]]]; p = Join[Rest[p], {NextPrime[p[[4]]]}]]; Riffle[Table[0,{2*max}], v, {2, -1, 3}] (* _Amiram Eldar_, Jan 21 2020 *)
%K nonn
%O 1,2
%A _Labos Elemer_, Apr 29 2003
%E Corrected by _T. D. Noe_, Nov 15 2006
%E a(50) corrected and more terms added by _Amiram Eldar_, Jan 21 2020