<s>[INST] A general formula to generate functions of power series I have been playing with Maclaurin series lately, I have been able to come across this:
$\dfrac{1}{1+x}=1-x+x^2-x^3+x^4-x^5...$
$\dfrac{1}{(1+x)^2}=1-2x+3x^2-4x^3+5x^4-6x^5+7x^6...$
I found out by accident that:
$\dfrac{1-x}{(1+x)^3}=1-2^2x+3^2x^2-4^2x^3+5^2x^4+6^2x^5...$
I found in an old paper of Euler that this can continue on with these functions:
$\dfrac{1-4x+x^2}{(1+x)^4}=1-2^3x+3^3x^2-4^3x^3+5^3x^4+6^3x^5...$
$\dfrac{1-11x+11x^2-x^3}{(1+x)^5}=1-2^4x+3^4x^4-4^4x^3+5^4x^4+6^4x^5...$
$\dfrac{1-26x+66x^2-26x^3+x^4}{(1+x)^5}=1-2^5x+3^5x^4-4^5x^3+5^5x^4+6^5x^5...$
$\dfrac{1-57x+320x^2-302x^3+57x^4-x^5}{(1+x)^5}=1-2^6x+3^6x^4-4^6x^3+5^6x^4+6^6x^5...$
and so on...
Is there a general formula to generate the functions on the right hand side? How did Euler calculate these series? I have to say I deeply respect him since only he and Ramanujan know how to play with series.
 [/INST] We are looking for polynomials $p_k(x)$ with
\begin{align*}
\frac{p_k(x)}{(1+x)^{k+1}}=\sum_{j=0}^\infty (-1)^j(j+1)^kx^j\qquad\qquad k\geq 0
\end{align*}

We can find $p_k(x)$ as follows:
\begin{align*}
\color{blue}{p_k(x)}&=\left(\sum_{j=0}^\infty(-1)^j(j+1)^kx^j\right)(1+x)^{k+1}\\
&=\left(\sum_{j=0}^\infty(-1)^j(j+1)^kx^j\right)\left(\sum_{l=0}^{k+1}\binom{k+1}{l}x^l\right)\\
&=\sum_{n=0}^\infty\left(\sum_{{j+l=n}\atop{j,l\geq 0}}\binom{k+1}{l}(-1)^j(j+1)^k\right)x^n\\
&\,\,\color{blue}{=\sum_{n=0}^\infty\left(\sum_{l=0}^{\min\{n,k+1\}}\binom{k+1}{l}(-1)^{n-l}(n-l+1)^k\right)x^n}\tag{1}
\end{align*}

OP's result indicates that for $k\geq 1$ we expect $p_k(x)$ to be a polynomial of degree less than or equal to $k-1$. We therefore want to show that for $k\geq 1$
\begin{align*}
p_k(x)=\sum_{n=0}^{\color{blue}{k-1}}\left(\sum_{l=0}^{\color{blue}{n}}\binom{k+1}{l}(-1)^{n-l}(n-l+1)^k\right)x^n\tag{2}
\end{align*}
In order to show (2) it is convenient  to use the coefficient of operator $[x^n]$ to denote the coefficient of $x^n$. This way we can write for instance
\begin{align*}
n^k=k![x^k]e^{nx}\tag{3}
\end{align*}

We obtain for $n\geq k+1$
\begin{align*}
\color{blue}{\sum_{l\geq 0}}&\color{blue}{\binom{k+1}{l}(-1)^{n-l}(n-l+1)^k}\\
&=\sum_{l\geq 0}\binom{k+1}{l}(-1)^{n-l}k![x^k]e^{x(n-l+1)}\tag{4}\\
&=(-1)^nk![x^k]e^{x(n+1)}\sum_{l\geq 0}\binom{k+1}{l}(-1)^le^{-lx}\tag{5}\\
&=(-1)^nk![x^k]e^{x(n+1)}\left(1-e^{-x}\right)^{k+1}\tag{6}\\
&=(-1)^nk![x^k]e^{x(n-k)}\left(e^x-1\right)^{k+1}\tag{7}\\
&\,\,\color{blue}{=0}\tag{8}
\end{align*}
and the claim (2) follows for $n\geq k+1$. Similarly the claim can be shown for $n=k$.

Comment:

*

*In (4) we apply the coefficient of operator according to (3).


*In (5) we do some rearrangements.


*In (6) we apply the binomial theorem.


*In (7) we factor out $e^{-x(k+1)}$.


*In (8) we note that $(e^x-1)^{k+1}=x^{k+1}+\cdots$ consists of terms with powers of $x$ greater than $k$.
</s>