I was working on a problem which involves computation of $k$-th power of first $n$ natural numbers.
Say $f(n) = 1^k+2^k+3^k+\cdots+n^k$ we can compute $f(n)$ by using Faulhaber's Triangle also by fast computation of Bernoulli numbers.
Here we have to compute $G(n)= f(1)+f(2)+f(3)+\cdots+f(n)$
I did some work on this to simplify but unable to come up with any easy equation.
Can someone help me how to compute $G(n)$ efficiently , I can efficiently compute $f(n)$.
Here $n<123456789$ and $k<321$.
Thanks.
$$G_k(n)= \sum_{i=1}^n f_k(i)= \sum_{i=1}^n \sum_{j=1}^i j^k = \sum_{j=1}^n (n+1-j) j^k=(n+1)\sum_{j=1}^n j^k - \left(\sum_{j=1}^n j^{k+1} \right)\\ =(n+1)f_k(n)-f_{k+1}(n)$$
Since you said you can efficiently calculate
$$f_{k}(n) =\sum_{j=1}^n j^k$$ you can also calculate efficiently $$(n+1)f_k(n)-f_{k+1}(n)=g_k(n)$$