A351914 Numbers m such that the average of the prime numbers up to m is greater than or equal to m/2.
2, 3, 4, 5, 6, 7, 8, 11, 13, 19
Offset: 1
Examples
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. 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.
Links
- Hassani Mehdi, A Refinement of Mandl's Inequality, report collection, 8 (2) (2005).
- Eric Bach and Jefrey Shallit, Algorithmic Number Theory, Vol. 1: Efficient Algorithms, Section 2.7, Cambridge, MA: MIT Press, 1996.
- Math Stackexchange, Is the average of primes up to n smaller than n/2, if n>19?
- Matt Visser, On the arithmetic average of the first n primes, arXiv:2505.04951 [math.NT], 2025. See p. 3.
Programs
-
Maple
s:= proc(n) s(n):= `if`(n=0, 0, `if`(isprime(n), n, 0)+s(n-1)) end: q:= n-> is(2*s(n)/numtheory[pi](n)>=n): select(q, [$2..20])[]; # Alois P. Heinz, Feb 25 2022
-
Mathematica
s[n_] := s[n] = If[n == 0, 0, If[PrimeQ[n], n, 0] + s[n-1]]; Select[Range[2, 20], 2 s[#]/PrimePi[#] > #&] (* Jean-François Alcover, Dec 26 2022, after Alois P. Heinz *)
-
Python
from sympy import primerange def average_of_primes_up_to(i): primes_up_to_i = list(primerange(2, i+1)) return sum(primes_up_to_i) / len(primes_up_to_i) def a_list(): return [i for i in range(2, 20) if average_of_primes_up_to(i) >= i / 2]
Comments