#P3768. 简单的数学题
简单的数学题
Description
Since the problem setter is too lazy to write a background, let's keep the problem simple.
Given two integers and , compute:
$$\left(\sum_{i=1}^n\sum_{j=1}^n ij \gcd(i,j)\right) \bmod p$$Here denotes the greatest common divisor of and .
Input Format
A single line containing two integers and .
Output Format
Output a single integer on one line, the answer.
998244353 2000
883968974
Hint
For 20% of the testdata, .
For 30% of the testdata, .
For 60% of the testdata, , time limit 1 s.
For another 20% of the testdata, , time limit 3 s.
For the last 20% of the testdata, , time limit 4 s.
For 100% of the testdata, and is prime.
Translated by ChatGPT 5
京公网安备 11011102002149号