Chance of adjacent lockers with the same combination One weird thing that happened to me in high school was that the combination lock on my locker had the exact same combination as the locker next to it. It always struck me that the odds were crazy on this, but I never calculated it.
The lock was a masterlock, the kind where you have 40 options for the first number, then 39 for the second (can't use the first number again), then 39 for the 3rd number (you can use the first number again for it).


*

*1/59,280 chance that two locks have the same combination. (40 * 39 * 39)

*1/29,640 chance that any specific combination is next to mine (w/2 lockers next to mine).


That gives a 1 in (59,280 * 29,640) chance that a specific combination is next to mine? Or a 1/1,757,059,200 chance.
This seems way too high, and there's probably something I'm missing here. Any thoughts on this calculation, or what it should be?
 A: As you correctly calculated, there is a $1$ in $40 \times 39 \times 39 = 60\,840$ of another lock having the same permutation (they're not combination locks, as order does matter).  So what is the probability that either of your neighbors has the same permutation?
It's easier to calculate the complementary event:  both of your neighbors have different permutations.  The probability is
$$
\begin{align}
P(\text{ diff. on left } \cap \text{ diff. on right }) &= P(\text{ diff. on left }) \times P(\text{ diff. on right }) \\
&= P(\text{ diff })^2 \\
&= \left( \frac{60839}{60840} \right)^2
\end{align}
$$
Therefore,
$$
\begin{align}
P(\text{ either neighbor same }) &= 1 - \left( \frac{60839}{60840} \right)^2 \\
&= \frac{121\,679}{3\,701\,505\,600} \\
&\approx 0.0000329,
\end{align}
$$
or roughly $1$ in $30\,420$.
A: It is worth examining the following related problem which has a very interesting non-intuitive answer: 

What is the probability that two people at a school of $1000$ have the same locker combination?

Since there are $59280$ different possible locker combinations, one might naively guess that for $1000$ students, the probability that two have the same locker combination is about $1$ in $59$. However, this heuristic is completely wrong, and the probability is much higher than $1$ in $59$.
Lets calculate the probability that all $1000$ students have different locker combinations. This equals $$\frac{59280}{59280}\cdot\frac{59279}{59280}\cdot \frac{59278}{59280}\cdots\frac{58281}{59280}=0.00020885\dots,$$ and so the probability that two students have the same locker combination is $0.99979$. In other words, in a school $1000$ students, there is a $99.979$% chance that two will have the same locker combination.
