login
(Number of primes between n^2 and (n+1)^2) - (number of primes between n and 2n).
10

%I #23 Sep 21 2021 19:51:23

%S 0,2,1,1,1,1,2,1,2,0,1,1,1,2,1,2,2,1,2,2,3,2,1,1,3,2,1,1,2,2,1,3,2,3,

%T 1,2,0,0,3,2,2,2,-1,3,2,3,0,4,6,0,1,4,4,1,1,-2,-1,3,-1,3,3,1,5,3,1,3,

%U 1,2,4,-1,6,1,1,4,4,4,7,-1,3,8,-2,5,3,5,1,0,5,5,1,2,3,2,1,5,3,3,2,3,4,1,2

%N (Number of primes between n^2 and (n+1)^2) - (number of primes between n and 2n).

%C Legendre's conjecture (still open) says there is always a prime between n^2 and (n+1)^2. Bertrand's postulate (actually a theorem due to Chebyshev) says there is always a prime between n and 2n.

%C Hashimoto's plot of (1 - a(n)) shows that |a(n)| is small compared to n for n < 30000.

%C From _Jonathan Sondow_, Aug 07 2008: (Start)

%C It appears that there are only a finite number of negative terms (see A143226).

%C If the negative terms are bounded, then Legendre's conjecture is true, at least for all sufficiently large n. This follows from the strong form of Bertrand's postulate proved by Ramanujan (see A104272 Ramanujan primes). (End)

%D M. Aigner and C. M. Ziegler, Proofs from The Book, Chapter 2, Springer, NY, 2001.

%D G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 5th ed., Oxford Univ. Press, 1989, p. 19.

%D S. Ramanujan, Collected Papers of Srinivasa Ramanujan (G. H. Hardy, S. Aiyar, P. Venkatesvara and B. M. Wilson, eds.), Amer. Math. Soc., Providence, 2000, pp. 208-209.

%H Vincenzo Librandi, <a href="/A143223/b143223.txt">Table of n, a(n) for n = 0..10000</a>

%H T. Hashimoto, <a href="http://arxiv.org/abs/0807.3690">On a certain relation between Legendre's conjecture and Bertrand's postulate</a>, arXiv:0807.3690 [math.GM], 2008.

%H M. Hassani, <a href="http://arXiv.org/abs/math/0607096">Counting primes in the interval (n^2,(n+1)^2)</a>, arXiv:math/0607096 [math.NT], 2006.

%H T. D. Noe, <a href="http://www.sspectra.com/math/A143223.gif">Plot of A143223(n) for n to 10^6</a>

%H J. Pintz, <a href="http://www.renyi.hu/~pintz/">Landau's problems on primes</a>

%H S. Ramanujan, <a href="http://ramanujan.sirinudi.org/Volumes/published/ram24.html">A proof of Bertrand's postulate</a>, J. Indian Math. Soc., 11 (1919), 181-182.

%H J. Sondow and E. W. Weisstein, <a href="http://mathworld.wolfram.com/BertrandsPostulate.html">Bertrand's Postulate in MathWorld</a>

%H J. Sondow, <a href="http://mathworld.wolfram.com/RamanujanPrime.html">Ramanujan Prime in MathWorld</a>

%H E. W. Weisstein, <a href="http://mathworld.wolfram.com/LegendresConjecture.html">Legendre's Conjecture in MathWorld</a>

%F a(n) = A014085(n) - A060715(n) (for n > 0) = [pi((n+1)^2) - pi(n^2)] - [pi(2n) - pi(n)] (for n > 1).

%e There are 4 primes between 6^2 and 7^2 and 2 primes between 6 and 2*6, so a(6) = 4 - 2 = 2.

%e a(1) = 2 because there are two primes between 1^2 and 2^2 (namely, 2 and 3) and none between 1 and 2. [_Jonathan Sondow_, Aug 07 2008]

%t L={0,2}; Do[L=Append[L,(PrimePi[(n+1)^2]-PrimePi[n^2]) - (PrimePi[2n]-PrimePi[n])], {n,2,100}]; L

%o (PARI) a(n)=sum(k=n^2+1,n^2+2*n,isprime(k))-sum(k=n+1,2*n,isprime(k)) \\ _Charles R Greathouse IV_, May 30 2014

%Y See A000720, A014085, A060715, A143224, A143225, A143226.

%Y Negative terms are A143227. Cf. A104272 (Ramanujan primes).

%K sign

%O 0,2

%A _Jonathan Sondow_, Jul 31 2008

%E Corrected by _Jonathan Sondow_, Aug 07 2008, Aug 09 2008