OFFSET
1,2
EXAMPLE
The two cubes nearest to 0 are 0 and 1, and, because 0+0+1 is a perfect cube, 0 is in the sequence.
The two cubes nearest to 1 are 0 and 1, and, because 1+0+1=2 is not a perfect cube, 1 is not in the sequence.
The two cubes nearest to 29 are 27 and 8, and, because 29+27+8=64=4^3 is a perfect cube, 29 is in the sequence.
MATHEMATICA
pcQ[n_]:=Module[{cr=Surd[n, 3]}, IntegerQ[Surd[Total[Nearest[Range[ Floor[ cr]-1, Ceiling[cr]+1]^3, n, 2]]+n, 3]]]; Select[Range[0, 520000], pcQ] (* Harvey P. Dale, Jul 25 2018 *)
PROG
(Python)
def icbrt(a):
sr = 1 << (int.bit_length(int(a)) >> 1)
while a < sr*sr*sr: sr>>=1
b = sr>>1
while b:
s = sr + b
if a >= s*s*s: sr = s
b>>=1
return sr
for k in range(1000000):
s = icbrt(k)
if k and s*s*s==k: s-=1
d1 = abs(k-s**3)
d2 = abs(k-(s+1)**3)
d3 = abs(k-(s-1)**3)
kxy = k + s**3 + (s+1)**3
if s and d3<d2: kxy = k + s**3 + (s-1)**3
r = icbrt(kxy)
if r*r*r==kxy: print(str(k), end=', ')
(Sage)
def gen_a():
n = 1
while True:
for t in range(n*(n*n + 3), (n+1)*(n*n + 2*n + 4) + 1):
c = t + (2*n + 1)*(n*n + n + 1)
if round(floor(c^(1/3)))^3 == c:
yield t
n += 1 # Ralf Stephan, Mar 09 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Mar 01 2014
STATUS
approved