OFFSET
0,3
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
PROG
(Haskell)
import Data.List.Ordered (union)
a188915 n = a188915_list !! n
a188915_list = union a000290_list a000079_list
-- Reinhard Zumkeller, May 19 2015, Apr 14 2011
(Python)
from math import isqrt
def A188915(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+x-isqrt(x)-((m:=x.bit_length()-1)>>1)-(m&1)
return bisection(f, n-1, n**2) # Chai Wah Wu, Sep 19 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Apr 14 2011
STATUS
approved