#P1891. Sum of Least Common Multiples
Sum of Least Common Multiples
Sum of Least Common Multiples
Given a positive integer \(n\), calculate the following sum:
[ S = \sum_{i = 1}^{n} \operatorname{lcm}(i, n), ]
where \(\operatorname{lcm}(i, n)\) denotes the least common multiple of \(i\) and \(n\). The answer should be computed exactly as defined above.
inputFormat
The input consists of a single integer \(n\) (\(1 \leq n \leq 10^5\)).
outputFormat
Output a single integer representing \(S\), the sum of \(\operatorname{lcm}(i, n)\) for all \(1 \leq i \leq n\).
sample
1
1