I wrote a post about how to tackle certain problems on numbers using dynamic programming techniques over at Stack Overflow. This includes tasks like
- "Find the sum of integers X with digit sum S, where X <= Y" (Y given)
- "Find the number of palindromic integers between L and R"
- "Enumerate all integers between L and R that only have digits 4 and 7"
- "Find the probability that an integer X uniformly chosen from the range [L,R] has at least 10 common digits with a given number S"
that can all be solved with a very similar idea. Just in case somebody's interested.