from phi import totient d = 10**6 s = 0 while d > 1: s += totient(d) d -= 1 print s
def h(n): s = 0 for x in xrange(1,n/2+1): s += (n/x-1)*phi.totient(x) return s*6