Teaser 3147: Noteworthy
From The Sunday Times, 15th January 2023 [link] [link]
Apparently in Costa Lotta a single-digit percentage of banknotes are forgeries and so I have designed a marker pen which tests whether notes are genuine. I thought it would be quite useful to the banks because, on average, for every N uses it only gives an incorrect result once (where N is some whole number).
Unfortunately my design has been abandoned by the banks because it turns out that on average for every N occasions on which the pen indicates a forgery, only one of the notes will in fact be forged!
What is N?
[teaser3147]
Jim Randell 5:23 pm on 13 January 2023 Permalink |
(See also: Enigma 1636).
If F is the single-digit percentage of forged notes then in a representative sample of X notes, then (F/100)X of them are actually forged.
And when the pen indicates N forgeries, in fact only one of the notes is forged, then the pen is giving false positives (i.e. it is testing some genuine notes as forgeries). It is not clear if the pen gives false negatives or not. In the following I assume the pen does not give false negatives (i.e. it will always indicate a forged note is forged, but it will also sometime indicate that a genuine note is forged), but see below for a treatment that includes false negatives.
If we suppose that when testing a quantity of notes, the pen indicates that a fraction f of them are forged.
Then if we test N notes (of which (F/100)N are forgeries) we get 1 false positive. So:
And if X is the quantity of notes required to get N positive tests, then:
But in this case only 1 of the notes is forged, so:
Combining the equations:
And we know F is a value in [1..9].
Run: [ @replit ]
from enigma import (irange, quadratic, printf) for F in irange(1, 9): for N in quadratic(F, -F, -100, domain="Z"): if N > 0: printf("F={F} N={N}")Solution: N = 5.
This is the case when there are no false negatives. (i.e. the pen always gives a positive test for a forgery, but sometimes will give a positive test for a genuine note).
In this case: F = 5, N = 5, fp = 4/19 (≈ 21.1%), fn = 0.
Applying the pen to a representative sample of 100 notes:
For an alternative interpretation of the puzzle, see my comment below.
I also wrote a simulation of testing 10 million notes with the pen, and it verifies the values produced give a viable solution to the puzzle. [@replit]
LikeLike
Jim Randell 12:51 pm on 14 January 2023 Permalink |
With a bit more work we can allow for false negatives as well as false positives:
The equations become:
It turns out there are many solutions that satisfy these equations.
Setting fn = 0 gives us the quadratic equation in my original comment.
But if we set fp = fn (= r) (i.e. the rate of false positives is the same as the rate of false negatives) then we get:
And this quadratic equation can be solved in a similar way to the previous one, and also gives a single solution to the puzzle:
Run: [ @replit ]
from enigma import (irange, quadratic, printf) for F in irange(1, 9): for N in quadratic(F, -2*F, 2*F - 100, domain="Z"): if N > 0: printf("F={F} N={N}")Solution: N = 8.
This is the case the false positive rate and false negative rate are the same.
In this case: F = 2, N = 8, fp = 1/8 (= 12.5%), fn = 1/8 (= 12.5%).
Applying the pen to a representative sample of 100 notes (or 10,000 notes if you don’t like fractional notes):
This scenario also tests as viable using the simulation code mentioned above.
I’m inclined to think this might be the intended interpretation, as we need to restrict F to a single digit integer in order to get a unique solution. But it would have saved some bother if the puzzle text had just stated that the rates of false positives and false negatives were equal.
And here is a solution where the false positive and false negative rates are similar (and smaller than in the published answer), but not equal:
F = 1, N = 11, fp = 890/9801 (≈ 9.1%), fn = 10/99 (≈ 10.1%).
Applying the pen to a representative sample of 100 notes:
LikeLike
Jim Randell 12:33 pm on 22 January 2023 Permalink |
The published answer was: N = 8.
Which confirms my suspicions that the false positive and false negative rates are intended to be the same.
LikeLike
Tony Smith 8:11 pm on 17 January 2023 Permalink |
Nothing in the wording suggests that the rates might be different.
LikeLike
Jim Randell 10:40 am on 18 January 2023 Permalink |
I think you need to assume that the false positive and false negative rates are the same in order to arrive at the intended solution. Something that could have easily been mentioned in the puzzle text.
LikeLike
Tony Smith 11:45 am on 18 January 2023 Permalink |
“on average, for every N uses it only gives an incorrect result once”
I think that is perfectly clear and unambiguous.
I also think that is immediately obvious that if the rates were different it would not be possible to deduce an answer without more information about the two rates.
The puzzle is actually solvable by the application of Bayes’s theorem with all relevant probabilities expressible in terms of N and the error rate.
LikeLike