P4466 [CTT] Sum and Product

Description

Given $n$, count the number of pairs $(a, b)$ that satisfy the following conditions: 1. $1 \le a < b \le n$. 2. $a + b$ divides $a \times b$.

Input Format

One line containing an integer $n$.

Output Format

One line containing an integer representing the answer.

Explanation/Hint

| Test | $N$ | Test | $N$ | | :----------: | :----------: | :----------: | :----------: | | $1$ | $\leq 10$ | $11$ | $\leq 5\times 10^7$ | | $2$ | $\leq 50$ | $12$ | $\leq 10^8$ | | $3$ | $\leq 10^3$ | $13$ | $\leq 2\times 10^8$ | | $4$ | $\leq 5\times 10^3$ | $14$ | $\leq 3\times 10^8$ | | $5$ | $\leq 2\times 10^4$ | $15$ | $\leq 5\times 10^8$ | | $6$ | $\leq 2\times 10^5$ | $16$ | $\leq 10^9$ | | $7$ | $\leq 2\times 10^6$ | $17$ | $\leq 10^9$ | | $8$ | $\leq 10^7$ | $18$ | $\leq 2^{31}-1$ | | $9$ | $\leq 2\times 10^7$ | $19$ | $\leq 2^{31}-1$ | | $10$ | $\leq 3\times 10^7$ | $20$ | $\leq 2^{31}-1$ | Source: 2012 CTT mutual test, by ayq. Translated by ChatGPT 5