Limit your base case to confirm your algorithm. Basically, your algorithm could theoretically generate numbers forever if it never returns an 8.

So, to test your algorithm, instead of a base case...