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.
%I A351914 #59 May 14 2025 05:45:40 %S A351914 2,3,4,5,6,7,8,11,13,19 %N A351914 Numbers m such that the average of the prime numbers up to m is greater than or equal to m/2. %C A351914 The average of the prime numbers up to m is asymptotically equal to m/2 by the prime number theorem. It is shown by Mandl's inequality that m/2 is strictly greater than the average if m > 19 and thus the sequence is complete. %H A351914 Hassani Mehdi, <a href="https://vuir.vu.edu.au/18085/">A Refinement of Mandl's Inequality</a>, report collection, 8 (2) (2005). %H A351914 Eric Bach and Jefrey Shallit, <a href="https://www.amazon.com/exec/obidos/ISBN%3D0262024055/">Algorithmic Number Theory, Vol. 1: Efficient Algorithms</a>, Section 2.7, Cambridge, MA: MIT Press, 1996. %H A351914 Math Stackexchange, <a href="https://math.stackexchange.com/questions/4391776/is-the-average-of-primes-up-to-n-smaller-than-fracn2-if-n-19">Is the average of primes up to n smaller than n/2, if n>19?</a> %H A351914 Matt Visser, <a href="https://arxiv.org/abs/2505.04951">On the arithmetic average of the first n primes</a>, arXiv:2505.04951 [math.NT], 2025. See p. 3. %F A351914 2*A034387(a(n))/A000720(a(n)) >= a(n). %e A351914 5 is a term since the average of the primes up to 5 is (2 + 3 + 5)/3 = 10/3, which is greater than 5/2. %e A351914 8 is a term since the average of the primes up to 8 is (2 + 3 + 5 + 7)/4 = 17/4 = 4.25, which is greater than 8/2 = 4. %p A351914 s:= proc(n) s(n):= `if`(n=0, 0, `if`(isprime(n), n, 0)+s(n-1)) end: %p A351914 q:= n-> is(2*s(n)/numtheory[pi](n)>=n): %p A351914 select(q, [$2..20])[]; # _Alois P. Heinz_, Feb 25 2022 %t A351914 s[n_] := s[n] = If[n == 0, 0, If[PrimeQ[n], n, 0] + s[n-1]]; %t A351914 Select[Range[2, 20], 2 s[#]/PrimePi[#] > #&] (* _Jean-François Alcover_, Dec 26 2022, after _Alois P. Heinz_ *) %o A351914 (Python) %o A351914 from sympy import primerange %o A351914 def average_of_primes_up_to(i): %o A351914 primes_up_to_i = list(primerange(2, i+1)) %o A351914 return sum(primes_up_to_i) / len(primes_up_to_i) %o A351914 def a_list(): %o A351914 return [i for i in range(2, 20) if average_of_primes_up_to(i) >= i / 2] %Y A351914 Cf. A000040, A000720, A034387. %K A351914 nonn,fini,full %O A351914 1,1 %A A351914 _Masahiko Shin_, Feb 25 2022