cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A329273 #28 Jan 08 2020 00:27:22
%S A329273 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,
%T A329273 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,
%U A329273 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
%N 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.
%C A329273 When n is not a prime number, a(n) expresses the size of the prime gap to which n belongs.
%F A329273 a(1)=1. If n is prime, a(n)=0; if not, a(n) = nextprime(n) - precprime(n) - 1.
%F A329273 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
%e A329273 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.
%t A329273 Array[Which[# == 1, 1, PrimeQ@ #, 0, True, Prime[# + 1] - Prime@ # - 1 &@ PrimePi@ #] &, 105] (* _Michael De Vlieger_, Nov 18 2019 *)
%o A329273 (PARI) a(n) = if (n==1, 1, if (isprime(n), 0, nextprime(n+1) - precprime(n-1) - 1)); \\ _Michel Marcus_, Dec 01 2019
%Y A329273 Cf. A072680, A151799, A151800.
%K A329273 nonn
%O A329273 1,8
%A A329273 _Todor Szimeonov_, Nov 11 2019