Count Numbers with Non-Decreasing Digits
Count the base-b numbers up to a bound whose digits never decrease, walking the bound digit by digit and adding closed-form counts of the completions.
Count the base-b numbers up to a bound whose digits never decrease, walking the bound digit by digit and adding closed-form counts of the completions.