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.

A334051 The difference between the number of prime numbers in the ranges (1, p_n] and (p_n, 2*p_n], where p_n is the n-th prime.

Original entry on oeis.org

0, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 3, 4, 5, 6, 5, 4, 6, 6, 6, 8, 7, 8, 8, 6, 6, 8, 9, 11, 12, 8, 9, 8, 9, 8, 10, 9, 10, 11, 12, 11, 12, 11, 12, 13, 14, 12, 10, 11, 12, 12, 13, 14, 13, 13, 13, 15, 16, 17, 18, 19, 18, 14, 14, 16, 17, 13, 14, 13, 15, 16, 17, 16, 16
Offset: 1

Views

Author

Ya-Ping Lu, Sep 11 2020

Keywords

Examples

			a(6) = 2*6 - pi(2*p_6) = 12 - pi(2*13) = 12 - pi(26) = 12 - 9 = 3.
		

Crossrefs

Programs

  • PARI
    a(n) = 2*n - primepi(2*prime(n)); \\ Michel Marcus, Sep 11 2020
  • Python
    from sympy import prime, primepi
    for n in range(1, 10001):
        a = 2*n - primepi(2*prime(n))
        print(a)
    

Formula

a(n) = 2*n - pi(2*p_n).
a(n) = 2*n - A020900(n). - Michel Marcus, Sep 11 2020
a(n) = 1 + A331677(n). - Alois P. Heinz, Oct 09 2020