Solution (source code)

= Solution

The <probability generating function> is
$$
\boxed{G_X(s)=\mathbb E[s^X]=\sum_{k=0}^{\infty}p_ks^k,}
$$
where the series is defined, with the usual power-series convention $s^0=1$ even at $s=0$. In particular $G_X(0)=p_0$ and $G_X(1)=1$.