#P10532. [XJTUPC 2024] 筛法
[XJTUPC 2024] 筛法
Problem Description
In number theory for algorithm competitions, we have encountered algorithms such as the Sieve of Eratosthenes, the linear sieve, Möbius inversion, the Du Jiao sieve, the Powerful Number sieve, the Min_25 sieve, and the Zhou Ge sieve to help optimize the complexity of some summations or products. Now here comes the question: which of the above algorithms will be used in today’s problem?
Given a positive integer , you need to compute
$$\sum\limits_{i=1}^n\sum\limits_{j=1}^n\lfloor \dfrac{n}{\max(i,j)}\rfloor [i \perp j]$$where indicates whether and are coprime. That is, when , the value of is ; otherwise, its value is .
Input Format
One line contains a positive integer ().
Output Format
Output one line containing an integer, representing the result of the above summation.
2
4
Hint
Translated by ChatGPT 5