login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A079054 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). 6
-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, -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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

2

COMMENTS

There is no gap before 2, so we start with prime 3.

LINKS

N. J. A. Sloane, Table of n, a(n) for n = 2..20000

Chris Caldwell, Prime Gaps [Broken link?]

Pe, J. L. Prime Gap Tug of War

C. Rivera, Puzzle 271: Prime gap tug of war.

FORMULA

a(n) = min(1, max(-1, A001223(n-1) - A001223(n))). - Charles R Greathouse IV, Nov 16 2012

EXAMPLE

prime(1) = 2 is closer to prime(2) = 3 than prime(3) = 5, so a(2) = -1.

MAPLE

# From N. J. A. Sloane, Mar 13 2016

a:=[]; 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];

elif q-p=r-q then a:=[op(a), 0]; else a:=[op(a), 1]; fi;

od:

a;

MATHEMATICA

Table[-Sign[Prime[n-1] - 2*Prime[n] + Prime[n+1]], {n, 2, 100}]

PROG

(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

CROSSREFS

Cf. A092243 (cumulative sum, negated), A268343.

Sequence in context: A254377 A285657 A182394 * A240356 A240354 A240352

Adjacent sequences:  A079051 A079052 A079053 * A079055 A079056 A079057

KEYWORD

easy,sign

AUTHOR

Joseph L. Pe, Feb 02 2003

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 21 09:13 EST 2018. Contains 317431 sequences. (Running on oeis4.)