# Euclid's game.

This is a discussion on Euclid's game. within the A Brief History of Cprogramming.com forums, part of the Community Boards category; is it true that if you make the 1st move on this game you always win?...

1. ## Euclid's game.

is it true that if you make the 1st move on this game you always win?

2. No. Consider 8 and 2.

3. im confused lol im playing the game and trying to figure out a pattern but theres always something that breaks the pattern. how come the game depends on the orignal two numbers and not who makes the first move?

edit: you can play the game here http://www.cut-the-knot.org/blue/EuclidAlg.shtml

4. i think i figured out the pattern. tell me if this is true.

Code:
``` if in the original 2 numbers, the bigger number is odd, whoever makes the 1st move wins!.

if in the original 2 numbers, the bigger number is even, whoever makes the 2nd move wins!```

5. The way to figure out who goes first is by calculating n/gcd(n,m) where n and m are the two numbers, n>m. If n/gcd(n,m) is odd, the 1st player will win. If it is even, then the 2nd player will win.