login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A341952
Let x = (prime(n+1) - prime(n))/2 modulo 3 for n >= 2, then a(n) = -1 if x = 2, otherwise a(n) = x.
2
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, -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, -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
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) = A102283(A028334(n)).
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