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.

A140208 a(n) = floor(n*Pi(n)/2).

This page as a plain text file.
%I A140208 #26 Jul 06 2025 17:48:54
%S A140208 0,1,3,4,7,9,14,16,18,20,27,30,39,42,45,48,59,63,76,80,84,88,103,108,
%T A140208 112,117,121,126,145,150,170,176,181,187,192,198,222,228,234,240,266,
%U A140208 273,301,308,315,322,352,360,367,375,382,390,424,432,440,448,456,464
%N A140208 a(n) = floor(n*Pi(n)/2).
%C A140208 I introduce this sequence which is A128913(n)/2 because it is closely related to the prime counting function Pi(n) and the sum of primes < n for large n.
%C A140208 This is, SumP(n) ~ n*Pi(n)/2. For n = 10^10 n*Pi(n)/2 = 2275262555000000000.
%C A140208 Sum primes < 10^n = 2220822432581729238. This has error 0.0245...For the largest known sum of primes, for sums < 10^20, we have n*Pi(n)/2 = 111040980128045942000000000000000000000. The sum of primes < 10^20 = 109778913483063648128485839045703833541. The error here is -0.01149... It converges quite slowly and better approximations have been found.
%C A140208 This relationship was derived by using the summation formula for an arithmetic progression. For the odd integers where n is even, let the first term = 1, the last term is n-1 and the number of terms is n/2. So the sum of the odd numbers < n is ((1 +n-1)*n/2)/2. If we let Pi(x) be the number of terms, we get the result n*Pi(n)/2. A closed formula, SumP(n) ~ n^2/(2*log(n)-1) is quite accurate. The best formula I have found is the remarkable SumP(n) ~ Pi(n^2).
%C A140208 This formula has an error of 6.162071097138 E-11 for the largest known sum of primes or sum < 10^20.
%C A140208 Proof: 2+3+..+prime(n) = A007504(n) ~ n^2 log n / 2 (Bach and Shallit, 1996). Let n = Pi(x) ~ x/log x. So A007504(n) ~ (x/log x)^2 log(x/log x) / 2 ~ x^2 / (2 log x) ~ Pi(x^2). QED. - _Thomas Ordowski_, Aug 12 2012
%C A140208 See the link Sum of Primes for derivations of these asymptotic formulas.
%H A140208 Cino Hilliard, <a href="http://docs.google.com/Doc?id=dgpq9w4b_26dtrq634m">Sum of Primes</a>.
%F A140208 Pi(n) is the prime counting function, the number of primes < n. Define SumP(n) is the sum of primes < n.
%t A140208 a[n_]:=Floor[n*PrimePi[n]/2];Array[a,58] (* _James C. McMahon_, Jul 06 2025 *)
%o A140208 (PARI) g(n) = for(x=1,n,print1(floor(x*primepi(x)/2)","))
%Y A140208 Cf. A007504, A128913.
%K A140208 nonn,uned
%O A140208 1,3
%A A140208 _Cino Hilliard_, Jun 09 2008