Codeforces Round 563 (Div. 2)
C
Ehab and a Special Coloring Problem
Codeforces
1300
原题
← BD →
翻译中…

You're given an integer $n$. For every integer $i$ from $2$ to $n$, assign a positive integer $a_i$ such that the following conditions hold:

翻译中…
  • For any pair of integers $(i,j)$, if $i$ and $j$ are coprime, $a_i \neq a_j$.
  • The maximal value of all $a_i$ should be minimized (that is, as small as possible).
翻译中…

A pair of integers is called coprime if their greatest common divisor is $1$.

翻译中…

Input

翻译中…

The only line contains the integer $n$ ($2 \le n \le 10^5$).

翻译中…

Output

翻译中…

Print $n-1$ integers, $a_2$, $a_3$, $\ldots$, $a_n$ ($1 \leq a_i \leq n$).

翻译中…

If there are multiple solutions, print any of them.

翻译中…

Note

翻译中…

In the first example, notice that $3$ and $4$ are coprime, so $a_3 \neq a_4$. Also, notice that $a=[1,2,3]$ satisfies the first condition, but it's not a correct answer because its maximal value is $3$.

翻译中…

样例

Input #1
4
Output #1
1 2 1
InputCopy OutputCopy
Input #2
3
Output #2
2 1
InputCopy OutputCopy
题目信息
题号
1174C
时间限制
1 s
内存限制
256 MB
标签
构造
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。