Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Last week Le Monde puzzle (I have not received this week issue yet!) was about deriving an optimal strategy in less than 25 steps for finding the 25 answers to a binary multiple choice test, when at each trial, only the number of correct answers is known.

Hence, if the correct answers are y1,…,y25, and the first guess is x1,…,x25, all taking values in {0,1}, the value of

$(y_1-x_1)^2+\cdots+(y_{25}-x_{25})^2$

is known. Changing only x25 into (1-x25) leads to the knowledge of the corresponding y25. If we keep changing each xi one at a time and downwards, in at most 24 steps, we know y25,…,y2, thus (y1-x1, hence y1. This shows that there exists a strategy with 25 steps or less that provides the answer to the multiple choice test. If we are unlucky enough in our choice, can we reach the 25 steps? Here is a simulation experiment to explore this question, where the stopping rule is associated with all wrong or all right remaining answers.


rangep=rep(0,25)

for (t in 1:10^6){

y=sample(c(0,1),25,rep=T)
x=sample(c(0,1),25,rep=T)
p=25
Delta=sum((x[1:p]-y[1:p])^2)
while ((Delta>0)&&(Delta

whose output is

> rangep[1]
1

so there was one occurrence where eliminating one yi at a time, we need to do the 25 steps. (Note I am not saying this is the optimal strategy, just one that satisfies the constraint.)
Filed under: R Tagged: Le Monde, mathematical puzzle, multiple answer test, R

var vglnk = {key: '949efb41171ac6ec1bf7f206d57e90b8'};
(function(d, t) {
var s = d.createElement(t);
s.type = 'text/javascript';
s.async = true;
// s.defer = true;
var r = d.getElementsByTagName(t)[0];
r.parentNode.insertBefore(s, r);
}(document, 'script'));

Related
ShareTweet

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or  here if you don't.