#K94677. Max Prime Distance Permutation

    ID: 38695 Type: Default 1000ms 256MiB

Max Prime Distance Permutation

Max Prime Distance Permutation

You are given an integer n. Your task is to generate a permutation of the numbers from 1 to n which maximizes the prime distance. In this context, a permutation is a rearrangement of the numbers {1, 2, …, n}.

A number p is prime if it satisfies the condition \( p > 1 \quad \text{and} \quad \nexists\, d \text{ such that } 2 \leq d \leq \sqrt{p} \text{ and } d \mid p \).

Although the concept of prime distance can be interpreted in different ways, it has been determined that arranging the numbers in descending order produces a valid permutation that maximizes this distance. For example:

  • For n = 4, one such permutation is [4, 3, 2, 1].
  • For n = 5, one such permutation is [5, 4, 3, 2, 1].

Your output should be the permutation in which the numbers are printed in descending order, separated by spaces.

inputFormat

The input consists of a single line containing an integer n (1 ≤ n ≤ 105).

outputFormat

Output a single line containing the n integers of the permutation separated by a single space.

## sample
1
1