TITLE: 100 sequential parking spaces
QUESTION [7 upvotes]: In my high school's math club today, we explored but did not solve this interesting problem:
100 autonomous robotic vehicles enter a warehouse in arbitrary order to park. Inside the  warehouse, there are 100 sequential parking spaces enumerated from 1 to 100. Each vehicle has an assigned number where it will attempt to park. However, there is an error in the programming such that if a vehicle finds its path to the assigned parking spot blocked by an already-parked robot, the robot will immediately park in the spot before it. For example, if vehicle 50 parks in spot 50 but vehicle 75 is immediately behind it, vehicle 75 will park in spot 49. Also, if vehicle 1 parks in spot 1, every robot behind it will be blocked from entering the warehouse at all. The vehicles do not have the ability to maneuver around already-parked vehicles.
What is the most likely number of robots that will be parked in the warehouse at the end of the routine?
So far the group came up with just some underlying intuition that the most likely number should be fewer than 50, as it is likely that some robot will park in position $\leq 50$ early on and leave many spaces unable to be occupied. I tried manually exploring small cases with 2, 3, 4, and 5 parking spaces, but this did not produce much help.

REPLY [2 votes]: Joannes' answer shows that that if there are $N$ parking spaces, the probability that exactly $n$ vehicles get parked is
$$
p_N(n)=\frac{(N-n)!}{N!}\left[(N-n+1)^n-(N-n)^n\right].
$$
I'm going to analyze where this is maximized.
For fixed $N$, it looks like $p_N(n)$ increases to its maximum, then decreases, so we're looking for the smallest $n$ for which $p_N(n+1)-p_N(n)<0$. This inequality is equivalent to
$$
\left(1+\frac{1}{N-n}\right)^n+\left(1-\frac{1}{N-n}\right)^{n+1}>2.
$$
We can expand as a series
$$
\sum_{k\geq 0} \left[{n\choose k}\frac{1}{(N-n)^k}+{n+1\choose k}\frac{(-1)^{k}}{(N-n)^k}\right]>2.
$$
Here I'm going to be a little imprecise: we should be able to argue that $n=o(N)$ as $N\to\infty$, so terms in the sum above for $k$ large contribute little. If we only include terms with $k\leq 2$, this simplifies to
$$
n^2+n>N,
$$
so we should expect the $n$ maximizing $p_N(n)$ to be about $\sqrt{N}$.