Integrating a fourier series

Hi there. I wanted to intagrate the fourier series for $\displaystyle g(t)=t^2$ to get the fourier series for $\displaystyle f(x)=t^3$

So I thought making something like:

$\displaystyle f(t)=3\int_0^t x^2 dx$

I know that $\displaystyle g(t)=t^2\sim \frac{p^2}{3}+\sum_{n=1}^{\infty}\frac{4p^2(-1)^n}{n^2\pi^2}\cos\left (\frac{n\pi t}{p}\right)$

p is for the period.

Then

$\displaystyle f(t)\sim 3\left [\int_0^tp^2dx+\sum_{n=1}^{\infty}\frac{4p^2(-1)^n}{n^2\pi^2}\int_0^t\cos\left (\frac{n\pi t}{p}\right)dx \right ]$

$\displaystyle f(t)\sim 3\left [p^2t+\sum_{n=1}^{\infty}\frac{4p^3(-1)^n}{n^3\pi^3}\sin\left (\frac{n\pi t}{p}\right)dx \right ]$

Now this is wrong, but I don't know why. What I get with this looks like x, I think that's because of the term $\displaystyle p^2t$. But I don't know what I'm doing wrong. Perhaps I have to do something else, but I don't know what, it actually doesn't look pretty much like a Fourier series.