Along a one-way street there are $n$ parking lots. One-by-one $n$ cars numbered 1, 2, 3, ..., n enter the street. Each driver $i$ heads to their favourite parking lot $a_i$ and if it is free, they occupy it . Otherwise, they continue to the next free lot and occupy it. But if all succeeding lots are occupied, they leave for good. How many sequences $(a_1,a_2,...,a_n)$ are there such that every driver can park?
If the answer was known to me, I would have used induction but I can't find the answer. I tried recursion but I failed to make progress. I am still trying but if you have some good idea please let me know. If I am able to solve it I will post the answer.
There is something called the parking function. Please read this. http://www-math.mit.edu/~rstan/transparencies/parking.pdf The answer is $f(n) = (n+1)^{(n-1)}$