Thank you very much Alvaro. I don't really understand what " histogram of digits is weakly increasing" means but I found an article about histograms on wikipedia. I will read it and hopefully understand it. Thank you.
"Histogram" is just a fancy name for "one counter for each possible value". I think my C++ code should be fairly easy to read, but I'll give you a couple of examples in English.
Let's see why the number 799 is not in the list. Let's count how many times each digit appear in 799: "0" appears 0 times, "1" appears 0 times, ..., "7" appears 1 time, "8" appears 0 times and "9" appears 2 times. Putting all ten counters in a row, it's (0,0,0,0,0,0,0,1,0,2), and this is what I am calling the "histogram". As you see there are more "7"s than "8"s, so this sequence is not weakly increasing.
Let's now see why the number 989 is in the list. The histogram is (0,0,0,0,0,0,0,0,1,2). This is weakly increasing (i.e., every number is either the same as the one before it or larger).