Every number is placed as a fixed-width string, so 7 under a bound of 275 is built as 007 and those padding zeros look like real digits to the recursion. For never uses a 7 that does no harm, but for anything that reads the digits themselves, no zero anywhere, strictly increasing digits, how many distinct digits, the invented zeros give a wrong answer. The fix is a second flag, usually called started, false while only zeros have been placed and true from the first nonzero digit, so the positions before it are skipped rather than counted as zeros.