Tuesday, 4 March 2014

Problem #9

Description :
Given n, calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n) denotes the Least Common Multiple of the integers i and n.

Input :
Input contain an integer n.

Output :
Output contains the required sum i.e LCM(1,n)+LCM(2,n) + .. + LCM(n,n).

Sample Input :
2
Sample Output :
4

No comments: