login
The OEIS is supported by the many generous donors 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
Chris Caldwell, Prime Gaps [Broken link?]
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: A176412 A013596 A182394 * A131695 A324113 A105812
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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 29 22:36 EDT 2024. Contains 374734 sequences. (Running on oeis4.)