1
$\begingroup$

There are two players $A$ and $B$.

There are two bags with $n_1$ and $n_2$ things in it.

$A$ will start the game and can take out $x$ where $1\leq x \leq \min(n_1,n_2)$ number of things from either of bags or both the bags.

A player looses the game if in his chance both the bags are empty.

Given $n_1$ and $n_2$, how to find who will win the game?

$\endgroup$
3
$\begingroup$

If $n\oplus_3m=0$ then $B$ will win, else it's A (assuming they plays perfectly).

$\oplus_3$ is the addition in base 3 without carry.

For example $7\oplus_35=0$ because $7_{10}=21_3$ and $5_{10}=12_3$ and $2\oplus_31=0$

You can prove that when $n\oplus_3 m\neq 0$, there is always a way to change the game such that you let a $\oplus_3$sum of $0$ to opponent, but if $n\oplus_3 m= 0$, there is no possibility to left a $\oplus_3$sum of $0$ to opponent.

$\endgroup$
  • $\begingroup$ The question changed. This answer supposed that you can take any number from each or both bags. Now it was changed, so this answer is no more ok. But I keep it, because I'm not sure what the OP really want. $\endgroup$ – Xoff Jan 3 '16 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.