All Tracks Math Number Theory Basic Number Theory-2 Problem

Numbers Summation
Tag(s):

Circuits, Mathematics, Medium, Number Theory, Number theory, Simple-math

Problem
Editorial
Analytics

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}\)

SAMPLE INPUT
5
SAMPLE OUTPUT
33
Explanation

\(F(1,1) = 1 , F(1,2) = 1 , F(1,3) = 1 , F(1,4) = 1 , F(1,5) = 1\)
\(F(2,2) = 3 , F(2,3) = 1 , F(2,4) = 3 , F(2,5) = 1\)
\(F(3,3) = 4 , F(3,4) = 1 , F(3,5) = 1\)
\(F(4,4) = 7 , F(4,5) = 1\)
\(F(5,5) = 6\)
On adding all of the above, we get \(33\).

Time Limit: 4,0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

April Circuits '17

OTHER PROBLEMS OF THIS CHALLENGE
Уведомления
View All Notifications

?