A253181 Numbers n such that the distance between n^3 and the nearest square is less than n.
1, 2, 3, 4, 5, 9, 13, 15, 16, 17, 25, 32, 35, 36, 37, 40, 43, 46, 49, 52, 56, 63, 64, 65, 81, 99, 100, 101, 109, 121, 136, 143, 144, 145, 152, 158, 169, 175, 190, 195, 196, 197, 225, 243, 255, 256, 257, 289, 312, 317, 323, 324, 325, 331, 336, 351, 356, 361, 366, 377
Offset: 1
Keywords
Examples
The distance between 5^3=125 and the nearest square 11^2=121 is less than 5, so 5 is in the sequence.
Links
- Daniel Mondot, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
dnsQ[n_]:=Module[{n3=n^3,sr},sr=Sqrt[n3];Min[n3-Floor[sr]^2, Ceiling[ sr]^2- n3]
Harvey P. Dale, Dec 23 2015 *) -
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=',')
Comments