# What is the function $f$ such that $\sum_{k=0}^n f(k)=n^3$?

\begin{align*} 1 &\leadsto 1 \\ 1+3 &\leadsto 2^2 \\ 1+3+5 &\leadsto 3^2 \end{align*} In general, if $f(x)=2x+1$, then $f(0)+f(1)+f(2)...f(n)=(n+1)^2$.

Now, \begin{align*} 1 &\leadsto 1 \\ 1+7+19+\cdots &\leadsto m^3 \\ \end{align*} Is there a function that generates these numbers?

Just take the difference between the next, and the current number. For example $(x+1)^2-x^2=2x+1$. Likewise, $(x+1)^3-x^3=3x^2+3x+1$, which is the expression you're looking for.
• @AAron That would work for any function, it is pretty intuitive that $\sum_{i=0}^n\left(f(i+1)-f(i)\right)=f(n+1)-f(0)$ – mniip Jul 4 '15 at 7:04