Consider the set $$S=\{1,2,3,4,5,\ldots,123456789\},$$ which consists of all positive integers whose digits strictly increase from left to right. This set is finite. What is the median of the set?
Like ... how do I start? I thought it would be 512 (which is clearly wrong).
Hint:
Assuming that the numbers in the set are ascendantly ordered the counts of $x$-digit numbers can be symbolically presented as
$$ \binom{9}{1},\binom{9}{2},\binom{9}{3},\binom{9}{4},\binom{9}{5},\binom{9}{6},\binom{9}{7},\binom{9}{8},\binom{9}{9}. $$
We see that the median of the set is the first 5-digit number. What is it?
Comment:
If $\binom{9}{0}$ were present (and the cardinality of the set were the even number $2^9=512$), the virtual "median" would be exactly between $\binom{9}{4}$ and $\binom{9}{5}$. But the numbers consisting of 0 digits do not exist. Therefore the median shifts one position to the right from its virtual value.