Learning Scientific Programming with Python (2nd edition)
P2.5.9: Euler's totient function
Question P2.5.9
Euler's totient function, $\phi(n)$, counts the number of positive integers less than or equal to $n$ that are relatively prime to $n$. (Two numbers, $a$ and $b$, are relatively prime if the only positive integer that divides both of them is 1; that is, if $\mathrm{gcd}(a,b) = 1$.)
Write a Python program to compute $\phi(n)$ for $1 \le n < 100$.
[Hint: You could use Euclid's algorithm for the greatest common divisor given in the example to Section 2.5.2.]