# Nim piles

**Discrete Mathematics**Level 5

Calvin and Lino decide to play a game of \(n\)-nim. In \(n\)-nim, the players start by choosing a random integer \(k\) from 1 to 1000 (inclusive). They then make \(k\) piles of stones with sizes \(1,2,\ldots, k.\) The players then proceed as in the game of nim. The players alternate turns. On a turn, a player may remove any number of stones from a single pile. The player who removes the last stone wins. If Lino gets to make the first move, the probability that he can win if both he and Calvin play optimally can be expressed as \(\frac{a}{1000}.\) What is \(a?\)