Given n , what is the sum of all gcd integers upto n with n?

106 Views Asked by At

Given an integer n, I want to find S = gcd(1,n) + gcd(2,n) + gcd(3,n) + ....gcd(n,n). Now , there are I have firgured that the number should be something like S = φ(n) + x. Now I can't draw a relation upon x. May be I have to use the property gcd(a,n) = gcd(a+kn,n) or something like this.