OFFSET
1,1
EXAMPLE
The nonprime numbers are 1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, ... which increase by 1 after term 4, term 5, term 8, etc.
MATHEMATICA
Join@@Position[Differences[Select[Range[100], !PrimeQ[#]&]], 1]
PROG
(Python)
from sympy import primepi
def A375926(n):
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x): return n+bisection(lambda y:primepi(x+1+y))-1
return bisection(f, n, n) # Chai Wah Wu, Sep 15 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Sep 11 2024
STATUS
approved