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.

A332086 a(n) = pi(prime(n) + n) - n, where pi is the prime counting function.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 3, 3, 2, 3, 3, 4, 4, 4, 4, 3, 4, 4, 6, 5, 5, 4, 4, 4, 4, 6, 6, 6, 6, 7, 6, 7, 8, 7, 7, 6, 6, 8, 7, 8, 7, 8, 10, 9, 9, 10, 9, 9, 8, 9, 10, 9, 8, 8, 8, 7, 9, 10, 10, 9, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13
Offset: 1

Views

Author

Ya-Ping Lu, Aug 22 2020

Keywords

Comments

This sequence is related to a theorem of Lu and Deng (see LINKS): “The prime gap of a prime number is less than or equal to the prime count of the prime number”, which is equivalent to “There exists at least one prime number between p and p+pi(p)+1”, or pi(p+pi(p)) - pi(p) > 1, where pi is prime counting function. The n-th term of the sequence, a(n), is the number of prime number between the n-th prime number p_n and p_n + pi(p_n) + 1. According to the theorem, a(n) >= 1.

Examples

			a(1) = pi(p_1 + 1) - 1 = pi(2 + 1) - 1 = 2 - 1 = 1;
a(2) = pi(p_2 + 2) - 2 = pi(3 + 2) - 2 = 3 - 2 = 1;
a(6) = pi(p_6 + 6) - 6 = pi(13 + 6) - 6 = 8 - 6 = 2;
a(80) = pi(p_80 + 80) - 80 = pi(409 + 80) - 80 = 93 - 80 = 13.
		

Crossrefs

Cf. A000720 (pi), A014688 (prime(n)+n).

Programs

  • Maple
    f:= n -> numtheory:-pi(ithprime(n)+n)-n:
    map(f, [$1..100]); # Robert Israel, Sep 08 2020
  • Mathematica
    a[n_] := PrimePi[Prime[n] + n] - n; Array[a, 100] (* Amiram Eldar, Aug 23 2020 *)
  • PARI
    a(n) = primepi(prime(n) + n) - n; \\ Michel Marcus, Aug 23 2020
  • Python
    from sympy import prime, primepi
    for n in range(1, 1001):
        a = primepi(prime(n) + n) - n
        print(a)
    

Formula

a(n) = pi(prime(n) + n) - n.
a(n) = A000720(A014688(n)) - n. - Michel Marcus, Aug 23 2020

Extensions

Name edited by Michel Marcus, Sep 02 2020