AT_ndpc2026_l 最小公倍数
Description
You are given a positive integer $ N $ and a permutation $ A = (A_1, A_2, \dots, A_N) $ of $ (1, 2, \dots, N) $ .
Consider a directed graph $ G $ with $ N $ vertices numbered from $ 1 $ to $ N $ . For every pair of integers $ (i, j) $ such that $ 1 \leq i < j \leq N $ , there are $ \mathrm{LCM}(A_i, A_j) $ directed edges from vertex $ i $ to vertex $ j $ . (Here, $ \mathrm{LCM} $ denotes the least common multiple.) There are no other edges in $ G $ .
For each $ v = 2, 3, \dots, N $ , find the number of paths from vertex $ 1 $ to vertex $ v $ , modulo $ 998244353 $ . Here, two paths are considered different if the sets of edges they pass through are different.
Input Format
The input is given from standard input in the following format:
> $ N $ $ A_1 $ $ A_2 $ $ \dots $ $ A_N $
Output Format
Print $ N-1 $ lines. On the $ i $ -th line, output the answer for $ v = i+1 $ .
Explanation/Hint
### Sample Explanation 1
The directed edges in $ G $ are as follows:
- From vertex $ 1 $ to vertex $ 2 $ : $ 6 $ edges
- From vertex $ 1 $ to vertex $ 3 $ : $ 3 $ edges
- From vertex $ 1 $ to vertex $ 4 $ : $ 12 $ edges
- From vertex $ 2 $ to vertex $ 3 $ : $ 2 $ edges
- From vertex $ 2 $ to vertex $ 4 $ : $ 4 $ edges
- From vertex $ 3 $ to vertex $ 4 $ : $ 4 $ edges
### Constraints
- $ 2 \leq N \leq 2 \times 10^5 $
- $ (A_1, A_2, \dots, A_N) $ is a permutation of $ (1, 2, \dots, N) $
- All input values are integers