#P2303. [SDOI2012] Longge 的问题

[SDOI2012] Longge 的问题

Description

Here is the problem: Given an integer nn, you need to compute i=1ngcd(i,n)\sum\limits_{i=1}^n \gcd(i, n), where gcd(i,n)\gcd(i, n) denotes the greatest common divisor of ii and nn.

Input Format

The input consists of a single line containing the integer nn.

Output Format

Output a single integer on one line representing the answer.

6

15

Hint

Constraints

  • For 60%60\% of the testdata, it is guaranteed that n216n \leq 2^{16}.
  • For 100%100\% of the testdata, it is guaranteed that 1n<2321 \leq n < 2^{32}.

Translated by ChatGPT 5