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.

Showing 1-1 of 1 results.

A377897 Numbers k such that k + PrimePi(k) is even.

Original entry on oeis.org

4, 5, 8, 10, 11, 14, 16, 17, 20, 22, 23, 25, 27, 30, 31, 33, 35, 38, 40, 41, 44, 46, 47, 49, 51, 54, 56, 58, 59, 62, 64, 66, 67, 69, 72, 73, 75, 77, 80, 82, 83, 85, 87, 90, 92, 94, 96, 97, 99, 102, 103, 105, 108, 109, 111, 114, 116, 118, 120, 122, 124, 126, 127, 129, 132, 134, 136, 137, 140
Offset: 1

Views

Author

N. J. A. Sloane, Nov 13 2024

Keywords

Crossrefs

Cf. A000720, A121053, A377994 (complement).

Programs

  • Mathematica
    Select[Range[200], EvenQ[# + PrimePi[#]] &] (* Paolo Xausa, Nov 13 2024 *)
  • Python
    from sympy import nextprime
    def A377897_gen(): # generator of terms
        p,q,a = 3,5,1
        while True:
            yield from range(p+a,q,2)
            p, q, a = q, nextprime(q), a^1
    A377897_list = list(islice(A377897_gen(),69)) # Chai Wah Wu, Nov 13 2024
    
  • Python
    from sympy import primepi, prevprime
    def A377897(n):
        def f(x):
            if x<=3: return n+x
            p = prevprime(x+1)
            i = int(primepi(p))
            return n+x-(p>>1)-(x-p-((i^x)&1)>>1)
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Nov 13 2024
Showing 1-1 of 1 results.