Hacker News new | ask | show | jobs
by lupire 913 days ago
More direct calculation:

For every distinct prime factor p (so, of 9 is a factor, use 3 not 9), only (p-1)/p of the natural numbers ≤ n are relatively prime to it. Pime. This overcpunts nothing, since prime factors are relatively prime to each other. (Proving this requires some analysis of remaimders / modular arithmetic. But working an example shows the pattern).

This gives a formula, phi(n = Sum (p_i ^ e^i)) = n • Product ((p_i -1)/p))

This also shows how OP (and maybe the coach) missed the point of math team.