OFFSET
1,2
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
MATHEMATICA
Select[Range[200], OddQ[# + PrimePi[#]] &]
PROG
(Python)
from sympy import prevprime, primepi
def A377994(n):
def f(x):
if x<=3: return n
p = prevprime(x+1)
i = int(primepi(p))
return n+(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
(Python)
from sympy import nextprime
def A377994_gen(): # generator of terms
p, q, a = 3, 5, 0
yield from (1, 2)
while True:
yield from range(p+a, q, 2)
p, q, a = q, nextprime(q), a^1
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paolo Xausa, Nov 13 2024
STATUS
approved