OFFSET
1,1
COMMENTS
a(43) = 147618899630. - Donovan Johnson
EXAMPLE
n=4: a(4)=15,differences between {47,53,59,61,67} are {6,6,2,6} corresponds to exactly four differences congruent to 2 mod 4,since before and after 47-43=4 or 71-67=4 are congruent to 0 mod 4.
MATHEMATICA
dp[x_] := Mod[Prime[x+1]-Prime[x], 4] pat[x_, h_] := Table[dp[x+j], {j, 0, h-1}] up[x_, h_] := Union[pat[x, h]] Table[fa=1; k=0; Do[s=up[n, h]; s1=Length[s]; s2=Part[u=pat[n+1, h], Length[u]]; s3=Part[w=pat[n-1, h], 1]; If[Equal[s1, 1]&&Equal[fa, 1]&&Equal[s2, 0]&&Equal[s3, 0], k=k+1; Print[{k, h, n, Prime[n], s, s1}]; fa=0], {n, 2, 200000}], {h, 1, 19}]
With[{c=Mod[Differences[Prime[Range[12*10^5]]], 4]}, Join[{5, 2}, Drop[ Flatten[ Table[ SequencePosition[ c, Join[ {0}, PadRight[ {}, n, 2], {0}], 1][[All, 1]], {n, 0, 25}]]+1, 3]]] (* The program generates the first 24 terms of the sequence. *) (* Harvey P. Dale, Dec 01 2022 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Mar 04 2003
EXTENSIONS
a(20)-a(37) from Donovan Johnson, Nov 16 2010
STATUS
approved