## UTS Open '21 P2 - Prime Array

View as PDF

Points: 10
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Edward is learning about prime numbers in math class today. Having just learnt what arrays are the day before, he decided to invent what he now calls a prime array. Specifically, he calls an array prime if the greatest common divisor of all its elements is . For example, and are prime but and are not. Having caught him dozing off in class, Mr. Brown challenges Edward to find an array that has exactly prime non-empty subarrays. Since Mr. Brown is not looking forward to spending more than a few hours reading over the array, he specifies that the array must contain no more than elements, and that all the elements of the array must be integers in the range . Now on the spot, Edward is asking you to help him solve this problem. Please help him find an array satisfying Mr. Brown's requirements.

#### Constraints

For this problem, you MUST pass the sample case in order to receive points.

It can be proven that an array satisfying the requirements always exists under the given constraints.

#### Input Specification

The first and only line of input contains an integer , as described in the problem statement.

#### Output Specification

First, output one line containing , the length of the array you have found.

Then output space separated integers , representing the elements of the array .

#### Sample Input

6

#### Sample Output

5
5 8 2 6 3

#### Explanation

The prime subarrays are: .

• commented on Feb. 9, 2021, 1:22 a.m. edit 4

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Feb. 9, 2021, 11:13 p.m.

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Feb. 9, 2021, 4:31 a.m.

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on Feb. 9, 2021, 3:40 a.m. edited

Just solve the problem lol

• commented on Feb. 9, 2021, 1:31 a.m.

Sub arrays of length one are valid as shown in the problem statement:

For example, and are prime but and are not