Numbers Summation
Practice
4.4 (20 votes)
Approved
Circuits
Math
Medium
Number theory
Number theory
Problem
91% Success 4306 Attempts 30 Points 4s Time Limit 256MB Memory 1024 KB Max Code
Professor Amit Gupta has given you a mathematical programming assignment. It goes as follows:
\(F(x,y)\) = sum of numbers that divide both x and y, i.e., sum of the common divisors of x and y.
Given the value of N, you are required to calculate the value of S.
\(S=\sum_{i=1}^{N}\) \(\sum_{j=i}^{N}\) \(F(i,j)\).
As the value of S can be large, find it modulo \(10^{9}+7\).
Input
Input contains only one number N.
Output
Output contains only one number, the value of S modulo \(10^9+7\).
Constraints
\(1\le N \le 10^{15}\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
12 votes
Tags:
AlgorithmsCombinatoricsMathMediumOpen
Editorial