#P1891. 疯狂 LCM

疯狂 LCM

Description

Given nn, compute

i=1nlcm(i,n)\sum_{i = 1}^n \operatorname{lcm}(i, n)

where lcm(i,j)\operatorname{lcm}(i, j) denotes the least common multiple of ii and jj.

Input Format

There are multiple test cases in a single test point.

The first line contains an integer TT, the number of test cases.

The next TT lines each contain one integer nn.

Output Format

For each test case, output one line with a single integer representing the answer.

3
1
2
5

1
4
55

Hint

  • Constraints:
    • For 30%30\% of the testdata, T5T \leq 5, n105n \leq 10^5.
    • For 100%100\% of the testdata, 1T3×1051 \leq T \leq 3 \times 10^5, 1n1061 \leq n \leq 10^6.

Translated by ChatGPT 5