OFFSET
1,2
COMMENTS
Distance can be zero, that is, cubes that are squares are included.
Numbers n such that A002938(n) < n.
LINKS
Daniel Mondot, Table of n, a(n) for n = 1..10000
EXAMPLE
The distance between 5^3=125 and the nearest square 11^2=121 is less than 5, so 5 is in the sequence.
MATHEMATICA
dnsQ[n_]:=Module[{n3=n^3, sr}, sr=Sqrt[n3]; Min[n3-Floor[sr]^2, Ceiling[ sr]^2- n3]<n]; Select[Range[400], dnsQ] (* Harvey P. Dale, Dec 23 2015 *)
PROG
(Python)
def isqrt(a):
sr = 1 << (int.bit_length(int(a)) >> 1)
while a < sr*sr: sr>>=1
b = sr>>1
while b:
s = sr + b
if a >= s*s: sr = s
b>>=1
return sr
for n in range(1000):
cube = n*n*n
r = isqrt(cube)
sqr = r**2
if cube-sqr < n or sqr+2*r+1-cube < n: print(str(n), end=', ')
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Mar 23 2015
STATUS
approved