576A.md (1865B)
1 Source: https://codeforces.com/problemset/problem/576/A 2 3 A. Vasya and Petya's Game 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Vasya and Petya are playing a simple game. Vasya thought of number *x* between 1 and *n*, and Petya tries to guess the number. 22 23 Petya can ask questions like: "Is the unknown number divisible by number *y*?". 24 25 The game is played by the following rules: first Petya asks all the questions that interest him (also, he can ask no questions), and then Vasya responds to each question with a 'yes' or a 'no'. After receiving all the answers Petya should determine the number that Vasya thought of. 26 27 Unfortunately, Petya is not familiar with the number theory. Help him find the minimum number of questions he should ask to make a guaranteed guess of Vasya's number, and the numbers *y**i*, he should ask the questions about. 28 29 Input 30 31 A single line contains number *n* (1 ≤ *n* ≤ 103). 32 33 Output 34 35 Print the length of the sequence of questions *k* (0 ≤ *k* ≤ *n*), followed by *k* numbers — the questions *y**i* (1 ≤ *y**i* ≤ *n*). 36 37 If there are several correct sequences of questions of the minimum length, you are allowed to print any of them. 38 39 Examples 40 41 Input 42 43 ``` 44 4 45 ``` 46 47 Output 48 49 ``` 50 3 51 2 4 3 52 ``` 53 54 Input 55 56 ``` 57 6 58 ``` 59 60 Output 61 62 ``` 63 4 64 2 4 3 5 65 ``` 66 67 Note 68 69 The sequence from the answer to the first sample test is actually correct. 70 71 If the unknown number is not divisible by one of the sequence numbers, it is equal to 1. 72 73 If the unknown number is divisible by 4, it is 4. 74 75 If the unknown number is divisible by 3, then the unknown number is 3. 76 77 Otherwise, it is equal to 2. Therefore, the sequence of questions allows you to guess the unknown number. It can be shown that there is no correct sequence of questions of length 2 or shorter.