cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A238599 Numbers k such that k+x+y is a perfect cube, where x and y are the two cubes nearest to k.

This page as a plain text file.
%I A238599 #19 Apr 11 2020 15:21:59
%S A238599 0,29,171,476,1015,1044,1907,3142,4815,7093,9882,13313,17452,22580,
%T A238599 28393,35118,42821,43120,51939,61874,72991,85835,99604,114759,131366,
%U A238599 150192,170009,191482,214677,240625,267588,296477,327358,361568,396775,434178,473843,475306,517455
%N A238599 Numbers k such that k+x+y is a perfect cube, where x and y are the two cubes nearest to k.
%e A238599 The two cubes nearest to 0 are 0 and 1, and, because 0+0+1 is a perfect cube, 0 is in the sequence.
%e A238599 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.
%e A238599 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.
%t A238599 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 *)
%o A238599 (Python)
%o A238599 def icbrt(a):
%o A238599     sr = 1 << (int.bit_length(int(a)) >> 1)
%o A238599     while a < sr*sr*sr:  sr>>=1
%o A238599     b = sr>>1
%o A238599     while b:
%o A238599         s = sr + b
%o A238599         if a >= s*s*s:  sr = s
%o A238599         b>>=1
%o A238599     return sr
%o A238599 for k in range(1000000):
%o A238599     s = icbrt(k)
%o A238599     if k and s*s*s==k:  s-=1
%o A238599     d1 = abs(k-s**3)
%o A238599     d2 = abs(k-(s+1)**3)
%o A238599     d3 = abs(k-(s-1)**3)
%o A238599     kxy = k + s**3 + (s+1)**3
%o A238599     if s and d3<d2:  kxy = k + s**3 + (s-1)**3
%o A238599     r = icbrt(kxy)
%o A238599     if r*r*r==kxy:  print(str(k), end=',')
%o A238599 (Sage)
%o A238599 def gen_a():
%o A238599     n = 1
%o A238599     while True:
%o A238599         for t in range(n*(n*n + 3), (n+1)*(n*n + 2*n + 4) + 1):
%o A238599             c = t + (2*n + 1)*(n*n + n + 1)
%o A238599             if round(floor(c^(1/3)))^3 == c:
%o A238599                 yield t
%o A238599         n += 1               # _Ralf Stephan_, Mar 09 2014
%Y A238599 Cf. A000578, A238489.
%K A238599 nonn
%O A238599 1,2
%A A238599 _Alex Ratushnyak_, Mar 01 2014