Solution:
We directly exhibit a sequence of moves that leads to having all of the first 2019 light bulbs on.
- If the light bulb numbered 2019 is off, we choose a=2019 and b=673, so that ba=3 is a prime number, and we change the state of both light bulbs. Now light bulb 2019 is on.
- If light bulb number 1 is off, we choose a=2 and b=1 and change the state of both. Now light bulb number 1 is on.
- If light bulb number 2 is off, we choose a=4 and b=2 and change the state of both. Now light bulb number 2 is on.
- If light bulb number k is off, with 1≤k≤2018, we choose a=2k and b=k and change the state of both. Now light bulb number k is on.
- If light bulb number 2018 is off, we choose a=4036 and b=2018 and change the state of both. Now light bulb number 2018 is on.
Note that every light bulb that is turned on during a move is then never changed in state again by subsequent moves: indeed, light bulb 2019 is changed in state only on the first turn, because in all subsequent turns light bulbs of the form k or 2k with 1≤k≤2018 are used and 2019 is odd, while if a light bulb k with 1≤k≤2018 has its state changed, in subsequent turns only light bulbs with numbers greater than k will be considered.
Note: this solution works only if the moves are applied in the order described above, otherwise one risks turning off again a light bulb that had previously been turned on.