reviewed
approved
reviewed
approved
proposed
reviewed
editing
proposed
return kmax def f(x): return int(n+x-primepi(x)-primepi(x>>1)+(x>=4))
def f(x): return int(n+x-primepi(x)-primepi(x>>1)+(x>=4))
return bisection(f, n, n) # Chai Wah Wu, Oct 17 2024
(Python)
from sympy import primepi
def A085118(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 int(n+x-primepi(x)-primepi(x>>1)+(x>=4))
return bisection(f, n, n) # Chai Wah Wu, Oct 17 2024
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
G. L. Cohen and S. L. Segal, <a href="http://www.fq.math.ca/Scanned/27-3/cohen.pdf">A note concerning those n for which phi(n)+1 divides n</a>, Fibonacci Quarterly , Vol. 27 , No. 3 (1989), no. 3, pp. 285-286.
proposed
editing