# Can an integer be decomposed as $\sum_{k=1}^{m}k^3$? (and how to find $m$?)

I have two questions:

1. I wonder how to check if an integer $$n$$ can be represented as:

$$n = \sum_{k=1}^{m}k^3$$

1. And if it can be decomposed this way, how to find $$m$$?

I tried to user an integral approximation like this: $$k = \sqrt[3]{4x}$$, but it is not correct, because I need an accurate (descrete) answer.

• Related Numberphile video. – Shaun Apr 5 at 15:17
• $k = \sqrt[4]{4x}$ rounded down would be better and $k=\sqrt{\sqrt{4x}+\frac14}-\frac12$ much better – Henry Apr 5 at 15:25
• @Henry how on Earth did you find that second k? :) – Nikita Hismatov Apr 5 at 15:27
• It is a solution to $x=\frac14n^2(n+1)^2$ – Henry Apr 5 at 15:39

Since $$\sum\limits_{k=0}^m k^3=\left(\frac{m(m+1)}{2}\right) ^2$$ (you can easily prove this by induction), $$n$$ necessarily has to be a perfect square $$i^2$$ because $$\frac{m(m+1)}{2}\in\mathbb{N}$$. Then we have $$m(m+1)=2i\Leftrightarrow m^2+m-2i=0.$$ If this equation has a positive integer root $$m_1$$, then $$\sum\limits_{k=0}^{m_1} k^3=n.$$ If such a root does not exist, the number $$n$$ cannot be represented in the desired way.

$$n$$ must be the square of a triangular number.

I.e. it must be a perfect square,

$$(\lfloor\sqrt{n}\rfloor)^2=n,$$

and $$(m(m+1))^2=4n,$$

where

$$m=\lfloor\sqrt[4]{4n}\rfloor.$$

• Is it from number theory? – Nikita Hismatov Apr 5 at 15:25
• @NikitaHismatov: no, simple algebra. – Yves Daoust Apr 5 at 15:33
• @NikitaHismatov: I have added the value of $m$. – Yves Daoust Apr 5 at 15:36
• Stupid downvote. This is the only answer that says how to test $n$ and compute $m$. – Yves Daoust Apr 9 at 15:30

Just to show how to prove the formula $$\sum_{k=1}^n k^3=\frac14n^2(n+1)^2$$ with no previous knowledge.

Let $$f:\Bbb R\to \Bbb R$$ be a function such that $$f(x)=f(x-1)+x^3$$ and $$f(0)=0$$. Assume for the moment that $$f$$ is a polynomial of degree $$4$$ like $$f(x)=ax^4+bx^3+cx^2+dx$$ (note that since $$f(0)=0$$, $$f$$ has no constant term).

Then $$ax^4+bx^3+cx^2+dx=a(x-1)^4+b(x-1)^3+c(x-1)^2+d(x-1)+x^3$$ So $$b=-4a+b+1$$ $$c=6a-3b+c$$ $$d=-4a+3b-2c+d$$ It is a triangular system. Solve it and you are almost done.

Now that you have the formula, you can prove it by induction.