What is the position of the surviving mouse?

The other answers are correct, but let me offer an alternative way to see it. Suppose you had 7 mouses, for example. Number them in binary and go through the cat's iterations:

001 -> 001
010 -> 010 -> 010
011 -> 011
100 -> 100 -> 100
101 -> 101
110 -> 110 -> 110
111 -> 111

In the first round the cat eats all mice ending in 1, so that only the ones ending in 0 are left. On the second round the cat eats all mice ending in 10, so that only the ones ending in 00 are left. And so on. (Alternatively, you can drop one trailing zero from all mice after the first round and iterate with always eating mice ending in 1.)

That is, if a mouse has $k$ trailing zeroes, it will survive exactly $k$ rounds. The last survivor is the one with the largest amount of trailing zeroes.

The number of trailing zeroes in the set $\{1,\dots,n\}$ is always maximized by a power of two and the maximizer is unique. (Please ask if you want a proof for this statement. It might work as a separate question, too.) The largest power of two that does not exceed $n$ is indeed $a_n = 2^{\lfloor \log_2 n \rfloor}$ as others have pointed out.


One can use recursion to solve such questions. Let $a_{n}$ be the number of the last mouse surviving when there are $n$ to begin with.

  • If $n$ is odd, $n = 2k+1$, then after one round we are left with $k$ mice, $2, 4, \ldots, 2k$ and we do the same procedure. The mouse that is left is $2a_k$. Thus, $$ a_{2k+1} = 2a_k. $$

  • If $n$ is even, $n = 2k$, then after one round we are left with $k$ mice again, the same ones. Thus $$ a_{2k} = 2a_k. $$

It follows by induction that $$ a_n = 2^{\lfloor \log_2 n \rfloor}. $$


If $n$ is even, then we have something like $[1, 2, 3, 4, 5, 6]$ becoming $[2, 4, 6]$, which is the same as playing a new game of size $n/2$ and multiplying the answer from $[1, 2, 3]$ by $2$.

If $n$ is odd, then we have something like $[1, 2, 3, 4, 5]$ becoming $[2, 4]$, which is the same as playing a new game of size $(n-1)/2$ and multiplying the answer from $[1, 2]$ by $2$.

We can simplify the two cases into one by saying $n$ becomes $\lfloor\frac{n}{2}\rfloor$ instead. Therefore:

$S(n) = 2S(\lfloor\frac{n}{2}\rfloor)$ where $S(1) = 1$

So $S(n) = 2^{\lfloor \log_2(n)\rfloor}$

This is also the same as finding the most significant bit of $n$ (i.e. the largest power of $2$ less than or equal to $n$). Write $n$ in binary and then set everything to $0$ except the leading bit.


Following Arthur's hint: after the $k$th round, the only mice that are left are the multiples of $2^{k+1}$. This is because in the $k$th round, the cat eats all the mice that are not divisible by $2^k$.

Let $2^k$ be the largest power of $2$ that is $\le n$, i.e. $k=\lfloor \log_2 n\rfloor$.

Then the last mouse is the largest mouse divisible by $2^k$, i.e. $m2^k$ where $m=\lfloor n/2^k\rfloor$.

So, the last mouse is $$m2^k = \lfloor n/2^k\rfloor 2^k = \lfloor 2^{\log_2 (n) - k}\rfloor 2^k = \lfloor 2^{\log_2 (n) - \lfloor \log_2 n\rfloor}\rfloor 2^{\lfloor \log_2 n\rfloor} = 2^{\lfloor \log_2 n\rfloor},$$ where we use the fact that $\log_2(n) - \lfloor \log_2 n \rfloor \in [0,1)$.