Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 39s1 days 16 hours 1 minutes 39 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 39s1 days 16 hours 1 minutes 39 seconds.

Sign in to watch this lesson
Advanced - Number Theory · 5:09
Euler's totient φ(n) counts the numbers from 1 to n that share no factor with n; sorting the fractions k/n by reduced denominator shows that the totients of the divisors of n add up to n. It is computed as n·Π(1 − 1/p) in O(√n) for one number or with a sieve for a whole range, and Euler's theorem uses it to shrink huge exponents, with an extra φ(m) when the base shares a factor with the modulus, which is exactly what power towers need.