Recently I bought a three-pack of these cool Nike Dri-FIT Crew Socks and I guess they mold them specifically for your left and right foot?

In getting ready for work this morning, I grabbed a pair of these bad boys, and I noticed that more often than not, the laundry place where I get my laundry done seems to pair them correctly (meaning that each “L” sock is paired with a corresponding “R” sock). I was wondering if they’re just hyper-considerate laundry folders over there, or if maybe it was just a coincidence.

Not recalling my statistics, I wrote a brute-force script to figure out what percentage of the time they would be bundled “correctly” when bundled at random:

https://gist.github.com/loisaidasam/1307fa9988404cbe1bed

And I found the answer to be an astonishing `40%`

!

```
$ python socks.py 3 -n 100000
3 pairs of socks
100000 iterations
{False: 60011, True: 39989}
Good 39.99% of the time
```

I don’t know about you, but I find that percentage to be super high! We’re saying that when choosing socks in random order, that almost half of the time they’ll end up being bundled “correctly” with three bundles of properly matched “R” and “L” socks!

`Update`

: I finished getting ready and hopped on my bike, and as I was commuting into work I started thinking about my results, specifically wondering if I could come up with a statistical explanation, and I think I figured it out.

Steps and corresponding probabilities:

- Choose one sock at random (cool 100% of the time, hard to mess this one up)
- Choose a sock that matches (cool 60% of the time – of the 5 remaining socks, 3 should be the correct match, and 2 the wrong one)
- Choose another remaining sock at random (cool 100% of the time)
- Choose a sock that matches this sock (cool 66.666…% of the time – of the remaining 3 socks, 2 are the correct match and 1 is wrong)
- The last two socks will always match each other (100%)

Now using statistics, you multiply the probabilities of these events happening (right?):

```
1.00 * 0.60 * 1.00 * 66.666 * 1.00
```

or in fractions

```
3/5 * 2/3
```

or

```
2/5
```

or

```
40%
```

Yay, math!