|
|
вернуться в форумexplanation to N%3 i see N%3 solution everywhere but does anyone have any explanation as to why the guy who has mod-3 no of stones should lose. Some logical or mathematical reason would be much appreciated. Re: explanation to N%3 Послано Xysia 21 июл 2008 22:54 Let's see that for every number k which is an integer power of 2, k mod 3 = 1, or 2. (To be exact - table of (k mod 3) for {1,2,4,8,16,32,64... is: {1,2,1,2,1,2,1,2,1,2,... So, you can see that it is impossible to get from (mod 3 = 0) position to another (mod 3 = 0) position in one move. Let n (number of remaining stones) = 3. The first player can make x=1 or x=2 move, but now the second player can counter by making 3-x move and win. So n=3 is a losing position. We have proven that it is impossible to get from one number of stones divisible by 3 to another number of stones divisible by 3 in one move. We can now prove, by the rule of mathematical induction, that every position with n divisible by 3 is a losing position. Let's look - if the first player begins from position with 3*x stones, after any move the opponent can counter by '1' or '2' move and create another position with lesser number of stones, also divisible by 3. In the second case, when first player begins from position with number of stones not divisible by 3 (so n%3=1 or n%3=2), _he_ can now make a '1' or '2' move which will create a (mod 3 = 0) position (which was proven to be losing) for his opponent. Thus, due to arbitrarity of n, any (n mod 3 != 0) position can create a losing position for the second player in one move, so it is a winning position for the first player. Re: explanation to N%3 Послано BigBin 24 июл 2008 20:30 Consider these. number of leave stones 1 win 2 win ---- because we can choose 1 or 2 3 lose sure ---- because if you choose 1 number of leave stones == 2 or if you choose 2 number of leave stones == 1 each player will be the winner. 4, 5 win, choose 1, 2 sure each player will be take 1 or 2 sure you will be the winner. 6 lose 7, 8 win .... we can assume if N mod 3 == 0 sure that person will be lose, otherwise we can choose the minimum of first number of stones = N mod 3 so each player will be the loser.
Re: explanation to N%3 Also we can consider a Grandy function for n from 1 to .... g[0] = 0 g[1] = 1 g[2] = mex{0, g[1]} = 2 g[3] = mex{g[1], g[2]} = 0 g[4] = mex{0, g[2], g[3]} = 1 g[5] = mex{g[4], g[3], g[1]} = 2 ...... g[n] = n%3 More strictly can be proved using mathematical induction Re: explanation to N%3 Послано sxk 23 июн 2015 12:38 What is the mex{ }? Re: explanation to N%3 Послано Egor 6 ноя 2016 16:32 |
|
|