Uniform depletion Markov chain (source code)

= Uniform depletion Markov chain

A finite stock decreases by choosing a uniformly random positive number of its remaining items at every step. The remaining stock is a <Markov chain> with $P(i,j)=1/i$ for $0\leq j<i$ and $P(0,0)=1$. State $0$ is an <absorbing state>, and every positive state is a <transient state>. If $e_i$ denotes the expected number of positive-stock steps before absorption, a first-step decomposition gives $e_0=0$ and $ie_i=i+\sum_{j<i}e_j$. Subtracting consecutive equations yields $e_i-e_{i-1}=1/i$, so $e_i=H_i$, the $i$th <harmonic number>.