A nine digit number has the property where the first digit equals the number of zeros and ones used in the number, the second digit equals the number of ones and twos used in the number, the third digit equals the number of twos and threes used in the number, etc. through the ninth digit equals the number of eights and nines used in the number. What could the number be?
A ten digit number has a similar property to the nine digit number. The first digit equals the number of zeros and ones used in the number, the second digit equals the number of ones and twos used in the number, etc. through the ninth digit. And also, the tenth digit equals the number of zeros and nines used in the number. What could this number be?
(In reply to
re: Attn: Ken Haley by Penny)
But that only works because the sum of the 10-digit solution happens to be exactly 20. In other words, what you've done is set i10 = 20 - sum(i1 to i9). Do we know this has to be the case? If so, do we know the sum of the digits in all 9-digit solutions has to be 15? It is, but is it just a coincidence? If we know it has to be true, we should be able to further optimize with this knowledge.
In any case, I'm going to have another look at this. I'm also going to study Charlie's recursive solution. I didn't think of a way to use recursion last night--but it was getting pretty late and I was pretty tired.
With regard to the "Option Strict" clause, yes--I've found that using it almost always improves perfomance--it's a good habit to always use it. Retrofitting existing code to use it isn't always easy though.
Thanks for your feedback. This is fun!