P27786 [洛谷] Light Switches
普及-
题目描述

Problem Description

Suppose there are $N$ lights (where $N$ is a positive integer not greater than 5000), numbered sequentially from 1 to $N$. Initially, all lights are turned on. The first person (numbered 1) turns off all the lights. The second person (numbered 2) turns on the lights that are multiples of 2. The third person (numbered 3) reverses the state of the lights that are multiples of 3 (i.e., turns on the lights that are off and turns off the lights that are on). Following the increasing order of numbers, each subsequent person behaves like the third person, reversing the state of the lights that are multiples of their own number. After the $N$-th person has finished their operation, which lights are turned off?

Input Format

The input consists of a single line containing an integer $N$, representing the number of lights.

Output Format

The output consists of a single line listing the numbers of the lights that are turned off, in ascending order, with each number separated by a space.

Sample Input and Output

Sample Input #1

10

Sample Output #1

1 4 9

Sample Input #2

5

Sample Output #2

1 4
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10
样例输出
1 4 9