luogu#P9308. 「DTOI-5」#1f1e33

「DTOI-5」#1f1e33

Background

In the middle of night.

Problem Description

Define the function $f(n) = \displaystyle\sum_{i = 1}^n \sum_{j = 1}^n \sum_{k = 1}^n [i + j + k = n] \operatorname{lcm}(i, \gcd(j, k))$.

Given nn, for all 1in1 \leq i \leq n, output all values of f(i)mod998244353f(i) \bmod 998244353.

Input Format

One line containing one integer nn.

Output Format

One line containing nn integers, representing all values of f(i)mod998244353f(i) \bmod 998244353.

10
0 0 1 4 11 20 42 60 100 134

Hint

Constraints

$$\def\or{\operatorname{or}} %\def\arrayscretch{1.5} \def\arraystretch{1.5} \begin{array}{|c|c|c|}\hline \textbf{Test Case ID}&n= &\textbf{Points}\cr\hline \sf1&100&10 \operatorname{pts}\cr\hline \sf2&10^3&10 \operatorname{pts}\cr\hline \sf3&10^4&20 \operatorname{pts}\cr\hline \sf4&10^5&20 \operatorname{pts}\cr\hline \sf5&/&40 \operatorname{pts}\cr\hline \end{array}$$

For 100%100\% of the testdata, 1n1061 \leq n \leq 10^6.

Translated by ChatGPT 5