Hi everybody, I would appreciate some help with an exercise. Here it is:

There are sequences in some numbers, which adds up to 10. For example, number 3523014 you can find 4 such sequences:

**352**3014

3**523**014

3**5230**14

35**23014**

We can find some 'wonderful' numbers, in which each digit is in at least one of such sequences.

For example, 3523014 is 'wonderful' number, but 28546 - is not (there is such sequence, which adds up to 10 and includes 5 at the same time).

I need to find number of such 'wonderful' numbers in interval [1, 8100000] (1 and 8100000 inclusively).

I've tried to solve it on my own using Python, but I'm quite new to programming and cannot think of algorithm, which will not give me wrong numbers among the right ones.

I don't want to mess up question, so I put actual code on pastebin:

It returns wrong answers like 91846, 91855, etc.

Thanks in advance for help!