Capped geometric waiting time (source code)

= Capped geometric waiting time
{title2=$X=\min(N,k)$}

For a positive-integer <geometric distribution> $P(N=j)=pq^{j-1}$ with $q=1-p$, the capped time has masses $pq^{j-1}$ for $1\leq j<k$ and $q^{k-1}$ at $k$. The last mass includes all later arrivals, not only $N=k$. Its <probability generating function> and <expected value> are
$$
G_X(s)=p\sum_{j=1}^{k-1}q^{j-1}s^j+q^{k-1}s^k,\qquad \mathbb E X=\frac{1-q^k}{p}.
$$
The expectation follows either by differentiating the <PGF> or summing the tail <probabilities> up to $k$.