The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A329273 a(1)=1. If n is prime, a(n)=0; if not, a(n) = (the smallest prime number greater than n) minus (the largest prime number smaller than n) minus 1. 0
 1, 0, 0, 1, 0, 1, 0, 3, 3, 3, 0, 1, 0, 3, 3, 3, 0, 1, 0, 3, 3, 3, 0, 5, 5, 5, 5, 5, 0, 1, 0, 5, 5, 5, 5, 5, 0, 3, 3, 3, 0, 1, 0, 3, 3, 3, 0, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 0, 1, 0, 5, 5, 5, 5, 5, 0, 3, 3, 3, 0, 1, 0, 5, 5, 5, 5, 5, 0, 3, 3, 3, 0, 5, 5, 5, 5, 5, 0, 7, 7, 7, 7, 7, 7, 7, 0, 3, 3, 3 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,8 COMMENTS When n is not a prime number, a(n) expresses the size of the prime gap to which n belongs. LINKS Table of n, a(n) for n=1..100. FORMULA a(1)=1. If n is prime, a(n)=0; if not, a(n) = nextprime(n) - precprime(n) - 1. The nonzero terms are one less than the nonzero terms of A072680. More precisely, a(n) = A072680(n) - sign(A072680(n)) for n > 1. - Rémy Sigrist, Nov 30 2019 EXAMPLE Let n=9. The smallest prime number, greater than 9 is 11, the largest prime number, smaller than 9 is 7. a(9)=11-7-1=3. MATHEMATICA Array[Which[# == 1, 1, PrimeQ@ #, 0, True, Prime[# + 1] - Prime@ # - 1 &@ PrimePi@ #] &, 105] (* Michael De Vlieger, Nov 18 2019 *) PROG (PARI) a(n) = if (n==1, 1, if (isprime(n), 0, nextprime(n+1) - precprime(n-1) - 1)); \\ Michel Marcus, Dec 01 2019 CROSSREFS Cf. A072680, A151799, A151800. Sequence in context: A265466 A002073 A247093 * A130719 A143606 A126660 Adjacent sequences: A329270 A329271 A329272 * A329274 A329275 A329276 KEYWORD nonn AUTHOR Todor Szimeonov, Nov 11 2019 STATUS approved

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

Last modified September 19 09:40 EDT 2024. Contains 376007 sequences. (Running on oeis4.)