## the little half (another Le Monde puzzle)

I found this Le Monde puzzle of June 16 I had stored and then somehow forgotten with my trips to Japan and Australia: There are n beans in a box, with 98≤n≤102). Two players take at each round either one bean from the box or “the little half” (i.e. the integral part of the half) of the remaining beans. The player remaining with a single bean to pick has lost. What is the value of n for which there exists no winning strategy for the second player? Now the R resolution is rather easy: Player 1 wins with n beans whatever his strategy if Player 2 loses with either (n-1) or [n/2] beans. This leads to a straightforward recursive function

```solve=function(n){
if (n<4){
solve=(n>1)}else{
solve=(!(solve(n-1)))&&(!solve(trunc(n/2)))}
solve}
```

as it is possible to win with 2 or 3 beans, providing the answer to the puzzle:

```> solve(98)
 TRUE
> solve(99)
 FALSE
> solve(100)
 FALSE
> solve(101)
 FALSE
> solve(102)
 TRUE
```

if not an explanation!

Update (5:40, Central Time Zone): Robin’s question made me realise I had changed the wording of the problem when trying to solve it, moving from the little half to the large half in the above code! This means I should have used ceiling instead of trunc. The corrected R code stands as follows:

```solve=function(n){
if (n<3){
solve=(n==2)}else{
solve=(!(solve(n-1)))&&(!solve(ceiling(n/2)))}
solve}
```

```> solve(98)
 FALSE
> solve(99)
 TRUE
> solve(100)
 FALSE
> solve(101)
 FALSE
> solve(102)
 FALSE
```

### 5 Responses to “the little half (another Le Monde puzzle)”

1. Martyn Says:

I think I have a non-recursive solution.

Consider the even numbers first. The winning set of even numbers is characterized as follows: If n factorizes as n = 2^m * R then there are two cases:
a) If R == 3, then you win if m is even
b) If R != 3, then you win if m is odd
If n is even and in the winning set then you should always take half.

Now for the odd numbers: n is in the winning set if you can force your opponent into the losing set of even numbers by subtracting 1, except for the case n==5 when you take the smaller half to leave n=3 for your opponent.

I have not proved this, but it works for numbers up to 300 so looks promising for a more formal attempt.

• xi'an Says:

Thanks, Martyn. I was not in France when the solution got published and so did not see the way Buser and Cohen solved their puzzle. As you may have noticed, my solutions are always rather pedestrians; for at least two reasons, (1) I want to propose an R based solution, often used in class later, and (2) I do not want to spend too much brain-time on the puzzle, having already a high enough dissipation factor!

• Martyn Says:

Fair enough. I just wanted to show how your “pedestrian” solution can be used as a basis for further investigation. I took the subset of 1:100 for which your solve function returned TRUE and inspected these numbers with the factorize function from the conf.design package, looking for a more general pattern. This kind of problem is definitely out of my reach without considerable computational help.

2. Robin Ryder Says:

How do you win with 3 beans?

• xi'an Says:

Easy, you take two beans from the box.. oh wait.. you cannot… darn!

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