login
A076432
Perfect powers for which the three closest perfect powers are smaller.
2
36, 144, 2209, 6436369, 312079766881, 328081510656, 11305787558464, 62854912315881, 79723540870416, 4550858480922601, 11435943732416784, 3109406220195722500, 6258210474706101136, 7596357574791306304, 21016258678615763761, 32645304184825666489
OFFSET
1,1
EXAMPLE
The three closest perfect powers to 36 are 32 (difference = 4), 27 (difference = 9) and 25 (difference = 11). The fourth closest is 49 (difference = 13). 32, 27 and 25 are smaller than 36, so 36 is in the sequence.
PROG
(Python)
from itertools import count, islice
from sympy import mobius, integer_nthroot
def A076432_gen(): # generator of terms
def f(x): return int(x+sum(mobius(k)*(integer_nthroot(x, k)[0]-1) for k in range(2, x.bit_length())))
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
a = bisection(f)
b = bisection(lambda x:f(x)+1, a, a)
c = bisection(lambda x:f(x)+2, b, b)
d = bisection(lambda x:f(x)+3, c, c)
for i in count(4):
e = bisection(lambda x:f(x)+i, d, d)
if d-a < e-d:
yield d
a, b, c, d=b, c, d, e
A076432_list = list(islice(A076432_gen(), 5)) # Chai Wah Wu, Sep 09 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Neil Fernandez, Oct 10 2002
EXTENSIONS
More terms from Jud McCranie and Robert G. Wilson v, Oct 11 2002
a(5)-a(10) from Donovan Johnson, Sep 03 2008
a(11)-a(16) from Donovan Johnson, Aug 01 2013
STATUS
approved