Problem

Source: 2017 Saudi Arabia JBMO TST 1.3

Tags: combinatorics



On the table, there are $1024$ marbles and two students, $A$ and $B$, alternatively take a positive number of marble(s). The student $A$ goes first, $B$ goes after that and so on. On the first move, $A$ takes $k$ marbles with $1 < k < 1024$. On the moves after that, $A$ and $B$ are not allowed to take more than $k$ marbles or $0$ marbles. The student that takes the last marble(s) from the table wins. Find all values of $k$ the student $A$ should choose to make sure that there is a strategy for him to win the game.