#B2092. Lamp Toggling Game
Lamp Toggling Game
Lamp Toggling Game
There are (N) lamps numbered from (1) to (N) with (N \leq 5000). Initially, all lamps are turned ON. The process is as follows:
1. Person 1 turns OFF all the lamps.
2. Person 2 turns ON every lamp whose index is a multiple of (2).
3. For every person (i) where (3 \leq i \leq N), they toggle (i.e. reverse the current state of) every lamp whose index is a multiple of (i).
After the (N)th person has finished, output the indices of the lamps that remain OFF.
inputFormat
The input consists of a single integer (N) ((1 \leq N \leq 5000)), representing the number of lamps.
outputFormat
Output the indices (separated by a space) of all lamps that are OFF after the process.
sample
1
1