OFFSET
1,1
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
MATHEMATICA
Select[Range[200], EvenQ[# + PrimePi[#]] &] (* Paolo Xausa, Nov 13 2024 *)
PROG
(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
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 13 2024
STATUS
approved