• + 3 comments

    This is my solution. The problem reduces to a simple nim game by the following argument...

    For each tower: Let '' be the height of the tower. Let '' be the number of odd prime divisors of , e.g. for .

    • If is odd, the size of the pile in the corresponding nim game is .
    • If is even, the size of the pile is .

    Reason why:

    Each pair of towers of the same height can effectly be removed from the game because any move by a player on one of the towers can be copied by their opponent on the other tower. Therefore, breaking a tower into

    • an even number of towers is effectively the same as removing it completely,
    • an odd number is effectively the same as reducing it to a single smaller tower.

    It follows that the highest power of that divides an even tower is irrelevant to chosing the optimal move, i.e. the factors are equivalent. Similarly all odd primes factors are equivalent. Thus an even tower of height is equivalent to a tower of height and the pile size in the corresponding nim game is , i.e. . Likewise an odd tower of height is equivalent to a tower of height and the pile size in the corresponding nim game is , i.e. .