Section 18.1 Three Questions for Euler phi
ΒΆ
{kβ£0<kβ€n,gcd(k,n)=1}
of residues modulo n which are coprime to n. Also don't forget we can use Sage to calculate it.
xxxxxxxxxx
euler_phi(25)
Subsection 18.1.1 Formulas
ΒΆOf course, such small values can be calculated by hand. But what about larger ones? Surely we don't want to have to check every number up to n just to compute Ο(n). And indeed, in Exercise 9.6.11 you should have gotten a formula. Do you remember it? The following Sage cell is a hint.xxxxxxxxxx
print(factor(275))
print(euler_phi(275))
print(275*(1-1/5)*(1-1/11))
Fact 18.1.1.
If n is the product of prime powers n=βki=1peii then we have the formula
Ο(n)=nkβi=1(1β1pi)
Proof.
Do Exercise 9.6.11!
Subsection 18.1.2 Relations
ΒΆOne piece of getting a formula for Ο is the rather interesting property Ο has (Fact 9.5.2) that if m,n are coprime then Ο(m)Ο(n)=Ο(mn). This is an important general property an arithmetic function may have.Definition 18.1.2.
We say that f(n) is multiplicative if
f(m)f(n)=f(mn) when m,n are coprime.
xxxxxxxxxx
def _(a=25,b=11):
pretty_print(html(r"$\phi(%s)=%s\text{ and }\phi(%s)=%s$"%(a, euler_phi(a), b, euler_phi(b))))
if gcd(a,b)==1:
pretty_print(html(r"And $\phi(%s\cdot %s)=%s\cdot %s=%s$, their product!"%(a, b, euler_phi(a), euler_phi(b), euler_phi(a*b))))
else:
pretty_print(html(r"But $%s$ and $%s$ aren't coprime, so $\phi(%s\cdot %s)=%s\neq %s\cdot %s$"%(a, b, a, b, euler_phi(a*b), euler_phi(a), euler_phi(b))))
Subsection 18.1.3 Summation (and limits)
ΒΆOne thing that might be useful to look at in a function is its behavior in the long term. In calculus, we certainly talk a lot about things like asymptotes, even asymptotes other than horizontal and vertical ones. Unfortunately, arithmetic functions don't often look that great in this way. For instance, let's look at the plot of Ο.
plot(euler_phi,1,100)
)xxxxxxxxxx
def _(n=275):
pretty_print(html("$%s$ factors as $%s$"%(n,latex(factor(n)))))
pretty_print(html("Its divisors are $%s$"%latex(divisors(n))))
pretty_print(html(r"The sum of $\phi$ of the divisors is $%s$"%sum([euler_phi(d) for d in divisors(n)])))