Le Monde puzzle [#1132]

A vaguely arithmetic challenge as Le weekly Monde current mathematical puzzle:

Given two boxes containing x and 2N+1-x balls respectively. If one proceeds by repeatedly transferring half the balls from the even box to the odd box, what is the largest value of N for which the resulting sequence in one of the boxes covers all integers from 1 to 2N?

The run of a brute force R search return 2 as the solution

lm<-function(N)
fils=rep(0,2*N)
bol=c(1,2*N)
while(max(fils)<2){
    fils[bol[1]]=fils[bol[1]]+1
    bol=bol+ifelse(rep(!bol[1]%%2,2),-bol[1],bol[2])*c(1,-1)/2}
return(min(fils))}

with obvious arguments that once the sequence starts cycling all possible numbers have been visited:

> lm(2)
[1] 1
> lm(3)
[1] 0

While I cannot guess the pattern, there seems to be much larger cases when lm(N) is equal to one, as for instance 173, 174, 173, 473, 774 (and plenty in-between).

3 Responses to “Le Monde puzzle [#1132]”

  1. Bill Anderson Says:

    I just noticed this interesting puzzle. It seems to me that the puzzle asks for the maximum N with the property, and you have found that 2 is the minimum N. I found that 9998 also has the property. Then I stopped looking. I too did not find a pattern to the Ns such that lm(N) = 1. Do you know anything more about the maximum N?

  2. […] article was first published on R – Xi'an's Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) […]

  3. […] by data_admin [This article was first published on R – Xi’an’s Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.