add calculation of phi(N)
correctly calculate gcd