Archive for number theory

Le Monde puzzle [#752]

Posted in R, Statistics with tags , , , , , , , on December 9, 2011 by xi'an

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.

[sourcecode language=”r” gutter=”false”]
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)
}
[/sourcecode]

When I ran the code, I found many solutions

[sourcecode language=”r” gutter=”false”]
[1] 1 0 0
[1] 2 0 0
[1] 3 0 0
[1] 5 1 1
[1] 6 1 1
[1] 7 1 1
[1] 10 2 2
[1] 12 3 3
[1] 13 3 3
[1] 14 3 3
[1] 16 4 4
[1] 17 4 4
[1] 18 4 4
[1] 19 4 4
[1] 20 4 4
[1] 21 4 4
[1] 24 5 5
[1] 28 6 6
[1] 29 6 6
[1] 32 7 7
[1] 64 12 12
[/sourcecode]

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:

[sourcecode language=”r” gutter=”false”]
curve((trunc(x/4)-trunc(x/20)-trunc(x/44)),
from=10,to=250,n=500)
curve((trunc(x/5)+trunc(x/11)-trunc(x/55)-
trunc(x/20)-trunc( /44)),from=10,to=250,add=TRUE,n=500)
[/sourcecode]

Puzzle of the week [26]

Posted in Statistics with tags , , , on July 3, 2010 by xi'an

Le Monde weekend puzzle for the past week (I have not peeked at the solution yet!) was quite straightforward: find those n‘s such that 2n divides n! and those n‘s for which 2n-1 divides n. Looking at the problem in the plane to Montpellier, I think that the solution is that no positive n exists such that 2n divides n! and powers of 2 are those numbers for which 2n-1 divides n.

My reasoning is

  1. that the numbers with the highest potential is a power of 2,
  2. that 2n-1 divides n! when n is of the form 2m, and
  3. therefore that no integer n can satisfy the harder constraint.

Proving that 2n-1 divides n! when n is of the form n=2m can be done by induction: it works for n=2 and if it works for 2m, then it works for n=2m+1 by considering a separation of n! into

(2^m)! \times (2^m+1)\cdots 2^{m+1}

and by using the induction assumption that (2m)! can be divided by

2^{2^m-1}.

Recycling the dividers for the second part leads to its being divisible by

2^{2^m}

because the very last term in the factorial is by 2m+1, which can be divided by 2m+1… Proving that integers other than the 2m‘s cannot be divided by 2n-1 again works by an induction proof on m.