OFFSET
1,4
COMMENTS
a(n) is nonnegative for n = 1,...,41252. At n = 41253, a(n) = -1. At most larger values of n, up to n = 250000 (as far as I've checked), a(n) is overwhelmingly negative.
Questions. Is s > 0 for some n > 250000? Is s bounded from below? Is s bounded from above? Is s > 0 for infinitely many values of n? Is s < 0 for infinitely many values of n?
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..20000
Pe, J. L., Prime Gap Tug of War, 2002
Pe, J. L., Prime Gap Tug of War, 2002 [Cached copy, pdf file only, with permission.] Shows extended graphs.
C. Rivera, Puzzle 271: Prime gap tug of war.
N. J. A. Sloane, Table of n, a(n) for n = 1..100000
N. J. A. Sloane, Table of n, a(n) for n = 1..965562
FORMULA
Cumulative sums of A079054 (negated).
EXAMPLE
At stage n = 1, the score a(1) = 0. The first prime gap is 3-2 = 1.
At stage n = 2, the second prime gap is 5-3 = 2 > 1, the previous prime gap. Hence a(2) = a(1) + 1 = 0 + 1 = 1.
At stage n = 3, the third prime gap is 7-5 = 2, which equals the previous prime gap. The score doesn't change; hence a(3) = 1.
At stage n = 4, the fourth prime gap is 11-7 = 4 > 2, the third prime gap. Hence a(4) = a(3) + 1 = 1+1 = 2.
MAPLE
# From N. J. A. Sloane, Mar 13 2016 (a is A079054, ss is the present sequence):
a:=[]; ss:=[0]; s:=0; M:=120; for n from 2 to M-1 do
q:=ithprime(n); p:=prevprime(q); r:=nextprime(q);
if q-p < r-q then a:=[op(a), -1]; s:=s+1;
elif q-p=r-q then a:=[op(a), 0]; else a:=[op(a), 1]; s:=s-1; fi;
ss:=[op(ss), s];
od:
a; ss;
MATHEMATICA
d = 1; c = 3; s = 0; r = {0}; For[i = 2, i <= 200, i++, e = Prime[i + 1]; newd = e - c; c = e; If[newd > d, s = s + 1, If[newd < d, s = s - 1]]; d = newd; r = Append[r, s]]; r
CROSSREFS
KEYWORD
sign
AUTHOR
Joseph L. Pe, Feb 19 2004
STATUS
approved