Go back
Lucky socks

Lucky socks

Posers and Puzzles

1 edit
Vote Up
Vote Down

Originally posted by wolfgang59
complicated solution to a "simple" problem. Well done iamatiger!

I found probability/statistics boring at Uni ... I wish I had paid more attention because its fascinating for me now.
I think his answer was extremely elegant and simple. For these type of probability problems with sequential properties posing it in a recursive way is usually an excellent and compact way to go about it (and one I tend to forget myself so much kudos to iamatiger)

Vote Up
Vote Down

Originally posted by iamatiger
I did a google search for this kind of problem, f(n) turned out to be called the number of derangements in the world of probability, represented as !n

The wikipedia page on that: http://en.wikipedia.org/wiki/Derangement
gives the weird equation:

f(n) = round(n!/e)

where round rounds to the nearest integer

seeing as p(n) = f(n-1)/(f(n-1 ...[text shortened]... (n-1)!)

A quick spreadsheet test shows this is a very good approximation for 5 days and over.
The approximation can be simplified even more without losing accuracy:

p(n) ~ (n-1)!/(n! + (n-1)!)

p(n) ~ 1/((n! + (n-1)!)/(n-1)!)

p(n) ~ 1/(n!/(n-1)! + 1)

p(n) ~ 1/(n + 1)

This is pretty good for 5 days (1.85% error) and gets very good for more than 5 days.