%I #52 Apr 01 2021 15:09:27
%S 1,1,-1,1,-1,1,-1,0,1,0,-1,1,-1,0,0,1,0,-1,1,0,-1,0,1,-1,1,-1,1,-1,1,
%T -1,0,1,-1,1,0,0,-1,0,0,1,-1,1,-1,1,0,0,-1,1,-1,0,1,-1,0,0,0,1,0,-1,1,
%U -1,1,-1,1,-1,1,0,-1,1,-1,0,1,0,0,-1,0,1,-1,1,-1,1,-1,1,0,-1,0,1,-1,1,-1,0,1,-1,1,-1,0,0,1,0,0,-1,0,0,1,0,-1
%N Let x = (prime(n+1) - prime(n))/2 modulo 3 for n >= 2, then a(n) = -1 if x = 2, otherwise a(n) = x.
%C 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.
%F a(n) = (A028334(n) mod 3), when 2 -> -1.
%F a(n) = A102283(A028334(n)).
%F a(n) = ((prime(n+1) - prime(n))/2 + 1) mod 3 - 1. - _Jon E. Schoenfield_, Mar 04 2021
%e 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).
%t aa = {}; Do[gap = Prime[n + 1] - Prime[n];
%t If[Mod[gap/2, 3] == 1, AppendTo[aa, 1],
%t If[Mod[gap/2, 3] == 2, AppendTo[aa, -1],
%t If[Mod[gap/2, 3] == 0, AppendTo[aa, 0]]]], {n, 2, 106}]; aa
%t a[n_] := Mod[(Prime[n + 1] - Prime[n])/2, 3, -1]; Array[a, 100, 2] (* _Amiram Eldar_, Feb 25 2021 *)
%o (PARI) a(n) = my(x=(prime(n+1) - prime(n))/2 % 3); if (x==2, -1, x); \\ _Michel Marcus_, Feb 26 2021
%Y Cf. A028334, A341765, A342156.
%K sign
%O 2
%A _Artur Jasinski_, Feb 24 2021