%I #27 Apr 03 2023 10:36:10
%S -1,0,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,0,1,-1,1,1,-1,1,-1,-1,1,1,-1,1,
%T -1,-1,1,-1,1,-1,1,-1,0,1,-1,0,1,-1,1,-1,1,-1,0,1,1,-1,-1,1,-1,1,0,0,
%U 1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,0,1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1
%N a(n) = -1 if the closest prime to prime(n) is prime(n-1); = 1 if the closest prime to prime(n) is prime(n+1); = 0 if prime(n-1) and prime(n+1) are equally close to prime(n).
%C There is no gap before 2, so we start with prime 3.
%H N. J. A. Sloane, <a href="/A079054/b079054.txt">Table of n, a(n) for n = 2..20000</a>
%H Chris Caldwell, <a href="https://t5k.org/glossary/xpage/PrimeGaps.html">Prime Gaps</a> [Broken link?]
%H Pe, J. L. <a href="http://www.numeratus.net/pgtow/pgtow.html">Prime Gap Tug of War</a>
%H C. Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_271.htm">Puzzle 271: Prime gap tug of war</a>.
%F a(n) = min(1, max(-1, A001223(n-1) - A001223(n))). - _Charles R Greathouse IV_, Nov 16 2012
%e prime(1) = 2 is closer to prime(2) = 3 than prime(3) = 5, so a(2) = -1.
%p # From _N. J. A. Sloane_, Mar 13 2016
%p a:=[]; M:=120; for n from 2 to M-1 do
%p q:=ithprime(n); p:=prevprime(q); r:=nextprime(q);
%p if q-p < r-q then a:=[op(a),-1];
%p elif q-p=r-q then a:=[op(a),0]; else a:=[op(a),1]; fi;
%p od:
%p a;
%t Table[-Sign[Prime[n-1] - 2*Prime[n] + Prime[n+1]], {n, 2, 100}]
%o (PARI) p=2;q=3;forprime(r=5,97,print1(sign(2*q-r-p)", "); p=q; q=r) \\ _Charles R Greathouse IV_, Nov 16 2012
%Y Cf. A092243 (cumulative sum, negated), A268343.
%K easy,sign
%O 2
%A _Joseph L. Pe_, Feb 02 2003