What is the chance that this code terminates?
This is an example of a branching process. The behavior of a branching process depends on the expected number of children, which in your case is $1.25 &gt; 1$. When this number is at most 1, the process gets extinct with probability 1. When the number is more than 1, it has a chance of surviving forever; the extinction probability is just what you calculated &mdash; you need to select the root which is smaller than 1.