%I M0466 N0170 #67 Jun 25 2024 11:28:28
%S 1,2,3,4,5,6,7,1,2,3,4,5,6,7,8,2,3,4,5,6,7,8,9,3,4,5,1,2,3,4,5,4,5,6,
%T 2,3,4,5,6,5,6,7,3,4,5,6,7,6,7,8,4,5,6,2,3,4,5,6,5,6,7,3,4,1,2,3,4,5,
%U 6,4,5,2,3,4,5,6,7,5,6,3,3,4,5,6,7,6,7,4,4,5,2,3,4,5,6,5,5,6,3,4,5,6,7,6,6
%N Least number of positive cubes needed to sum to n.
%C No terms are greater than 9, see A002804. - _Charles R Greathouse IV_, Aug 01 2013
%D D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 81.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%D A. R. Zornow, De compositione numerorum e cubis integris positivus, J. Reine Angew. Math., 14 (1835), 276-280.
%H David A. Corneth, <a href="/A002376/b002376.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)
%H Simon Plouffe, <a href="https://arxiv.org/abs/0911.4975">Approximations de séries génératrices et quelques conjectures</a>, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
%H Simon Plouffe, <a href="/A000051/a000051_2.pdf">1031 Generating Functions</a>, Appendix to Thesis, Montreal, 1992
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CubicNumber.html">Cubic Number</a>
%F The g.f. conjectured by Simon Plouffe in his 1992 dissertation,
%F -(-1-z-z^2-z^3-z^4-z^5-z^6+6*z^7)/(z+1)/(z^2+1)/(z^4+1)/(z-1)^2, is incorrect: the first wrong coefficient is that of z^26. - _Robert Israel_, Jun 30 2017
%p f:= proc(n) option remember;
%p min(seq(procname(n - i^3)+1, i=1..floor(n^(1/3))))
%p end proc:
%p f(0):= 0:
%p map(f, [$1..100]); # _Robert Israel_, Jun 30 2017
%t CubesCnt[n_] := Module[{k = 1}, While[Length[PowersRepresentations[n, k, 3]] == 0, k++]; k]; Array[CubesCnt, 100] (* _T. D. Noe_, Apr 01 2011 *)
%o (Python)
%o from itertools import count
%o from sympy.solvers.diophantine.diophantine import power_representation
%o def A002376(n):
%o if n == 1: return 1
%o for k in count(1):
%o try:
%o next(power_representation(n,3,k))
%o except:
%o continue
%o return k # _Chai Wah Wu_, Jun 25 2024
%Y Cf. A000578, A003325 (numbers requiring 2 cubes), A047702 (numbers requiring 3 cubes), A047703 (numbers requiring 4 cubes), A047704 (numbers requiring 5 cubes), A046040 (numbers requiring 6 cubes), A018890 (numbers requiring 7 cubes), A018888 (numbers requiring 8 or 9 cubes), A055401 (cubes needed by greedy algorithm).
%K nonn,nice
%O 1,2
%A _N. J. A. Sloane_
%E More terms from Arlin Anderson (starship1(AT)gmail.com)