Digital Diversity
Jelly, 4 bytes
ṖaWḅ
Try it online! or verify all test cases
How it works
ṖaWḅ Main link. Argument: n
Ṗ Pop; yield [1, 2, 3, ..., n-1].
W Wrap; yield [n].
a Logical AND; yield [n, 2, 3, ..., n-1].
ḅ Convert the result from base n to integer.
Python, 40 bytes
f=lambda n,k=1:n*(n<k+2)or-~f(n,k+1)*n-k
Test it on Ideone.
How it works
A number with n distinct digits must clearly be expressed in base b ≥ n. Since our goal is to minimize the number, b should also be as small as possible, so b = n is the logical choice.
That leaves us with arranging the digits 0, …, n-1 to create a number as small as possible, which means the most significant digits must be kept as small as possible. Since the first digit cannot be a 0 in the canonical representation, the smallest number is
(1)(0)(2)...(n-2)(n-1)n = nn-1 + 2nn-3 + … + (n-2)n + (n-1), which f computes recursively.
Python 2, 54 46 bytes
This is a very very very! fast, iterative solution.
n=r=input();k=2
while k<n:r=r*n+k;k+=1
print r
Try it online
There's no recursion, so it works for large input. Here's the result of n = 17000
(takes 1-2 seconds):
http://pastebin.com/UZjgvUSW