While Bass's solution is correct, I'll give a more constructive proof that
all n work.
Proof:
By induction/construction. The base case of $n=1$ is solved just by picking $1$.
Suppose that you have a set S containing a selection of numbers which will solve the problem of colouring $1$ to $n-1$ black. Then you can extend this to work for $n$ as well depending on the nature of $n$.
1. If $n$ is divisible by $p^2$, then $n$ and $n/p$ are affected by exactly the same elements of S, so $n$ will already be coloured black.
2. If $n$ is a prime, then just choose $n$ to colour it black without affecting any smaller numbers. (Actually this is a special case of the next one)
3. If $n$ is a product of distinct primes, then you can change its colour by choosing as your moves the set of divisors of $n$, including $n$ itself but excluding $1$. These moves will toggle $n$'s colour without affecting any smaller numbers (proof below). You can then combine these with the moves in S, throwing out any duplicate moves, to get the set of moves that colour the numbers from $1$ to $n$.
In this way you can build up a solution to any $n$. For example:
$\{1,5,6\}$ is a solution for $n=6$. $7$ is prime so just add it to get
$\{1,5,6,7\}$ as a solution for $n=7$. $8$ and $9$ are divisible by squares, so
$\{1,5,6,7\}$ is also a solution for $n=9$. $10$ is a product of distinct primes, so add $\{2,5,10\}$ to get
$\{1,2,6,7,10\}$ as a solution for $n=10$. The two $5$ moves cancel each other.
Now for proof that if $n$ is a product of distinct primes, then the set T of divisors excluding $1$ when used as colouring moves will toggle only $n$.
Let $k<n$. Let $p$ be any prime that divides $n$ but does not divide $k$, which must exist since $n$ uses each prime only once and $k$ cannot include all of them.
The moves from $T$ that affect the colour of $k$ can be gathered in pairs that differ only by a factor of $p$. Therefore $k$ is affected by an even number of moves, and will have no net colour change. For example, if $n=30$ we have $T=\{2,3,5,6,10,15,30\}$, and then for any odd number $k$ we can ignore the move $\{2\}$ as it won't affect $k$ and pair the other moves as $\{3,6\},\{5,10\},\{15,30\}$ where each pair will have no net effect on $k$.
The number $n$ itself is affected by all the moves in $T$, and since there are an odd number of them (if $n$ is the product of $m$ primes, then $|T|=2^m-1$ since $1$ is excluded) the number will change colour.