#P17269. [ICPC 2017 Urumqi R] Sum of the Line

    ID: 19659 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>数学2017数论记忆化搜索莫比乌斯反演容斥原理ICPC

[ICPC 2017 Urumqi R] Sum of the Line

Problem Description

Consider a triangle of integers, denoted by TT. The value at (r,c)(r,c) is denoted by Tr,cT_{r,c}, where 1≤r1 \le r and 1≤c≤r1 \le c \le r. If the greatest common divisor of rr and cc is exactly 11, Tr,c=cT_{r,c} = c, or 00 otherwise.

Now, we have another triangle of integers, denoted by SS. The value at (r,c)(r,c) is denoted by Sr,cS_{r,c}, where 1≤r1 \le r and 1≤c≤r1 \le c \le r. Sr,cS_{r,c} is defined as the summation ∑i=crTr,i\sum_{i=c}^{r} T_{r,i}.

Here comes your turn. For given positive integer kk, you need to calculate the summation of elements in kk-th row of the triangle SS.

Input Format

The first line of input contains an integer t(1≤t≤10000)t (1 \le t \le 10000) which is the number of test cases. Each test case includes a single line with an integer kk described as above satisfying 2≤k≤1082 \le k \le 10^8.

Output Format

For each case, calculate the summation of elements in the kk-th row of SS, and output the remainder when it divided by 998244353998244353.

2
2
3
1
5