The Riddler Shirt Store sells N kinds of shirts, each kind with a picture of a different famous mathematician. Unfortunately, on average, 80 percent of orders are returned.
That’s because the company’s website has customers order their shirts using a code (from 1 to N), but does not state which code corresponds to which shirt. Each customer knows which mathematician — and therefore which shirt — they want.
But to get that desired shirt, they enter a random shirt code and order the corresponding shirt without knowing which mathematician they’ll get. If that shirt depicts the wrong mathematician, they randomly select a different (untested) code, and repeat this process until the desired shirt arrives.
How many different shirts does the store sell?
Since the codes are random, a customer is equally likely to select their desired shirt on the 1st try, or 2nd try, or 3rd try, etc.
If the desired shirt is selected on the 1st try, then there is 1 order and 0 returns.
If a the desired shirt is selected on the 2nd try, then there are 2 orders and 1 return.
In general, selecting the desired shirt on the kth try results in k orders and k - 1 returns.
For N shirts, the number of orders can range from 1 to N, with the corresponding number of returns ranging from 0 to N - 1.
Total orders = N * (N + 1) / 2
Total returns = (N - 1) * N / 2
If Total returns / Total orders = 80% = 4 / 5, then
(N - 1) / (N + 1) = 4 / 5
And we can solve for N to get
More generally, if R is the fraction of total orders returned, we can find the number of shirts N by setting:
(N - 1) / (N + 1) = R
N = (1 + R) / (1 - R)