#P12408. Constructing a Sequence with Equal LCMs

    ID: 14510 Type: Default 1000ms 256MiB

Constructing a Sequence with Equal LCMs

Constructing a Sequence with Equal LCMs

Given an integer (n) ((n \ge 2)), construct a sequence ({a_1, a_2, \dots, a_n}) of length (n) satisfying the following conditions:

  1. (1 \le a_i \le 10^6) for all (i).
  2. (a_i \neq a_{i+1}) for every (1 \le i < n).
  3. Let (L = \operatorname{lcm}(a_1, a_2, \dots, a_n)), then [ L = \operatorname{lcm}(|a_2 - a_1|, |a_3 - a_2|, \dots, |a_n - a_{n-1}|). ]
  4. (L \le 10^6).

Here, (\operatorname{lcm}(\cdot)) denotes the least common multiple. If no such sequence exists, output -1.

After thorough analysis, one can show that for any (n \ge 2) no sequence can satisfy these conditions. (In the case (n=2), for any two distinct positive integers (a_1, a_2), it is clear that (\operatorname{lcm}(a_1, a_2) \ge \max(a_1,a_2) > |a_2-a_1|). For larger (n) a similar contradiction always appears.)

inputFormat

A single integer (n) ((n \ge 2)).

outputFormat

If a valid sequence exists, output the sequence as (n) space-separated integers. Otherwise, output -1.

sample

2
-1