Euler phi function
Multiplicative Property of Euler Phi Function
Compute the Euler phi function for the integer .
p = eulerPhi(35)
p = 24
The Euler phi function satisfies the multiplicative property if the two integers and are relatively prime (also known as coprime). The integer factorization of 35 is 7 and 5, which are relatively prime. Show that satisfies the multiplicative property.
Calculate and for the two factors.
px = eulerPhi(7)
px = 6
py = eulerPhi(5)
py = 4
py satisfy the multiplicative property.
p = px*py
p = 24
Euler's Product Formula
If a positive integer has prime factorization with distinct prime factors , then the Euler phi function satisfies the product formula
The integer has distinct prime factors and . Show that satisfies the Euler's product formula.
Declare as a symbolic number and evaluate .
n = sym(36)
p = eulerPhi(n)
List the prime factors of .
f_n = factor(n)
Substitute the prime factors and into the product formula.
p_product = n*(1-1/2)*(1-1/3)
Euler's theorem states that if and only if the two positive integers and are relatively prime. Show that the Euler phi function satisfies Euler's theorem for the integers and .
a = 15; n = 4; isCongruent = powermod(a,eulerPhi(n),n) == mod(1,n)
isCongruent = logical 1
a and n are relatively prime.
g = gcd(a,n)
g = 1
Mean Value of Euler Phi Function Results
Calculate the Euler phi function for the integers from 1 to 1000.
P = eulerPhi(1:1000);
Find the mean value of .
Pave = mean(P./(1:1000))
Pave = 0.6082
n — Input
number | vector | matrix | array | symbolic number | symbolic array
Input, specified as a number, vector, matrix, array, symbolic number, or symbolic
array. The elements of
n must be positive integers.
Euler Phi Function
The Euler phi function computes the number of integers between 1 and n that are relatively prime (also known as coprime) to n. Two integers are relatively prime if there is no integer greater than one that divides them both. In other words, their greatest common divisor is one.
 Redmond, D. Number Theory: An Introduction to Pure and Applied Mathematics. New York: Marcel Dekker, 1996.
Introduced in R2020a