In a game , there are N numbers and 2 player(A and B) . If A and B pick a number and replace it with one of it's divisors other than itself alternatively, how would I conclude who would make the last move? (Notice that eventually when the list gets replaced by all 1's , you can't make any more moves). Any help would be appreciated, thank you :)
2026-03-29 11:44:11.1774784651
On
Game of replacing number with divisors
1.8k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
1
On
Conclusion comes when the player is faced with a list of 1's and a prime number somewhere, the player is forced to replace the prime number with 1. Ending the game (since a prime number can only be divided by 1 and itself)
EDIT.
unless the game requires some criterion that the player must respect for choosing numbers it's impossible to determine the end game at the very start.
imagine the list 2,3,25
let's suppose player 1 begins.
first scenario:
p1 takes 2 list reduces to: 1,3,25
p2 takes 3 list reduces to: 1,1,25
p1 takes 5 list reduces to: 1,1,5
p2 takes 5 list reduces to: 1,1,1 ENDGAME with player 1
second scenario:
p1 takes 2 list reduces to: 1,3,25
p2 takes 3 list reduces to: 1,1,25
p1 takes 25 list reduces to: 1,1,1 ENDGAME with player 2
REEDIT. i've just seen in the comments that the author of the post was assuming a best possible move criteria. so refer to the other answers given.
As I mentioned in the comments, this is essentially a version of the ancient game known as Nim. This game has been thoroughly analysed and the Wikipedia article gives a good description of the winning strategy for Nim, so that will not be repeated here. Instead, I'll explain why the OP's game is just Nim in disguise.
For those unfamiliar with Nim, here's a brief description, from the linked Wikipedia article:
Each of the $N$ numbers in the OP's game corresponds to a Nim heap. The objects in a given heap are the prime factors of that heap's number.
For example, let's say we start with the 3 numbers 7, 30, 100. That gives us 3 heaps:
{7}, {2, 3, 5}, and {2, 2, 5, 5}.
If $d$ is a divisor of $n$ the list of prime factors of $d$ is a sublist of the list of prime factors of $n$. So when we make a move in the OP's game, replacing $n$ by $d$, we remove the prime factors of $n/d$ from the $n$ heap, which will leave the prime factors of $d$ in the heap.
Eg, we can replace 30 by 5 by removing the factors of $30 / 5 = 6$, i.e. by removing the 2 and the 3.
When a heap is empty it has the value of the empty product, which is one.
FWIW, we can convert this game into actual Nim form by writing each of the prime factors of each of the $N$ numbers onto cards or other small objects.