Solution (source code)

= Solution

The standard run recursion gives $E_n=1+p^{-1}+\cdots+p^{-n}=(1-p^n)/[(1-p)p^n]$.