Solution (source code)

= Solution

A state is recurrent when, starting there, the chain returns to it with probability one. An irreducible chain is recurrent when every state is recurrent.