Here you will find daily news and tutorials about R, contributed by over 750 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

After a loooong break, here is one Le Monde mathematical puzzle I had time to look at, prior to going to Dauphine for a Saturday morning class (in replacement of my R class this week)! The question is as follows:

A set of numbers {1,…,N} is such that multiples of 4 are tagged C and multiples of 5 and of 11 are tagged Q. Numbers that are not multiples of 4, 5, or 11, and numbers that are multiples of both 4 and 5 or of both 4 and 11 are not tagged. Find N such that the number of C tags is equal to the number of Q tags.

This is a plain enumeration problem.

N=0
noco=TRUE
nbC=nbQ=0
while (noco){
N=N+1
divF=FALSE
if (trunc(N/4)*4==N){
nbC=nbC+1
divF=TRUE
}
if ((trunc(N/5)*5==N)||(trunc(N/11)*11==N)){
if (divF){
nbC=nbC-1
}else{ nbQ=nbQ+1}
}
noco=(nbC!=nbQ)
}

with no value further than 64 (testing all the way to 3,500,000). This seems in line with the fact that there are more multiples of 5 or 11 than of 4 when N is large enough. This can be seen by drawing the curves of the (approximate) number of multiples: