# Sunday Times Teaser 2930 – Odd Socks

*by Victor Bryant*

#### Published November 18 2018 (link)

I had a drawer containing some black socks and some white socks. If I drew out two socks at random the chance of getting a black pair was 1 in …

After many washes all the socks looked grey. So I added some red socks to the drawer. Then if I drew out two at random the chance of getting a grey pair was 1 in …

After many washes all the socks looked pink. So I added some green socks to the drawer. Then if I drew out two the chance of getting a pink pair was 1 in …

After many washes all the socks looked brown. So I have now added some yellow socks to the drawer giving me a total of fewer than fifty socks. Now if I draw out two the chance of getting a brown pair is 1 in …

The gaps above consist of four different prime numbers.

If I draw out two socks at random, what is the chance of getting a yellow pair?

Here’s a different approach.

The program find possible (prime, X, Y) tuples for choosing a pair of X socks from X+Y, and then links together the appropriate number of tuples.

You can run the code online at [ https://repl.it/@jim_r/teaser2930 ].