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.

A351914 Numbers m such that the average of the prime numbers up to m is greater than or equal to m/2.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 11, 13, 19
Offset: 1

Views

Author

Masahiko Shin, Feb 25 2022

Keywords

Comments

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.

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.
		

Crossrefs

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]

Formula

2*A034387(a(n))/A000720(a(n)) >= a(n).