#P8670. [蓝桥杯 2018 国 B] 矩阵求和
[蓝桥杯 2018 国 B] 矩阵求和
Problem Description
After passing many written tests and interviews, Xiao Ming successfully joined Macrohard.
Today, Xiao Ming's task is to fill in a table like this:
The table has rows and columns, and both row and column indices start from .
The value of the element in row and column is the square of , where means the greatest common divisor. Below are the first four rows and first four columns of the table:
1 1 1 1
1 4 1 4
1 1 9 1
1 4 1 16
Xiao Ming suddenly had a strange idea. He wants to know the sum of all elements in this table.
Since the table is too large, he hopes to use the power of a computer.
Input Format
One line with one positive integer , as described in the problem.
Output Format
One line with one number, the sum of all elements. Since the answer is large, output the result modulo (i.e. ).
4
48
Hint
For of the testdata, .
There is of the testdata where .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5