OFFSET
2
COMMENTS
Theorem B: apart from the initial term, the subsequence of nonzero terms is alternately +1 and -1 (the subsequence {1, 1} occurs only once, at the start)- for proof see A342156.
FORMULA
a(n) = (A028334(n) mod 3), when 2 -> -1.
a(n) = ((prime(n+1) - prime(n))/2 + 1) mod 3 - 1. - Jon E. Schoenfield, Mar 04 2021
EXAMPLE
a(5)=1 (note that offset is 2, so n-th successive number in this sequence has index n+1) because prime(5+1)=13 and prime(5)=11, then gap=13-11=2, and now gap/2=1 which is congruent to 1 (mod 3).
MATHEMATICA
aa = {}; Do[gap = Prime[n + 1] - Prime[n];
If[Mod[gap/2, 3] == 1, AppendTo[aa, 1],
If[Mod[gap/2, 3] == 2, AppendTo[aa, -1],
If[Mod[gap/2, 3] == 0, AppendTo[aa, 0]]]], {n, 2, 106}]; aa
a[n_] := Mod[(Prime[n + 1] - Prime[n])/2, 3, -1]; Array[a, 100, 2] (* Amiram Eldar, Feb 25 2021 *)
PROG
(PARI) a(n) = my(x=(prime(n+1) - prime(n))/2 % 3); if (x==2, -1, x); \\ Michel Marcus, Feb 26 2021
CROSSREFS
KEYWORD
sign
AUTHOR
Artur Jasinski, Feb 24 2021
STATUS
approved