GCD Eulers algorithm