Pandigital Numbers Exceeding a Ratio

97 Views Asked by At

The problem is described in here: Define a number to be pandigital if each digit from $0$ to $9$ appears in its representation at least once. We want to find the least number $n$ such that the proportion of pandigital numbers not greater than $n$ exceeding a given bound $b$.

The first try is to count the number of pandigital numbers not greater than $n$, denoted by $c_n$, in $O(log(n))$, by enumerating from high to low digits, but we still cannot obtain the smallest $n$ satisfying $\frac{c_n}{n} \geq b$. I'd like to ask how to obtain the smallest $n$ satisfying the condition.

1

There are 1 best solutions below

0
On BEST ANSWER

I'll answer the question by myself. Suppose for some $n$, we have calculated $c_n$ (of course $\frac{c_n}{n} \lt b$). If assuming all integers larger than $n$ is pandigital, we can calculate the least integer $\delta$ such that $\frac{c_n+\delta}{n+\delta}\geq b$. Since the assumption may not be true, the actual proportion may be less than $b$. Then we can repeat the above for $n+\delta$. As $n$ goes larger, we finally obtain the smallest $n$ satisfying the condition.