human
Euler 's Totient Function | Python 3 program to calculate Euler ' s ▁ Totient ▁ Function ▁ using ▁ Euler ' s product formula.
Consider all prime factors of n and for every prime factor p , multiply result with ( 1 - 1 / p ).
Check if p is a prime factor ..
If yes , then update n and result.
If n has a prime factor greater than sqrt ( n ) ( There can be at - most one such prime factor ).
Driver program to test above function"
Solution in Python:
 What is a code to euler 's Totient Function and the other steps required?
assistant
#Here is code to euler 's Totient Function and the other steps required.
 def phi ( n ) :
	p = 2
	while p * p <= n :
		if n % p == 0 :
			while n % p == 0 :
				n = n // p
			result = result * ( 1.0 - ( 1.0 / float ( p ) ) )
		p = p + 1
	if n > 1 :
		result = result * ( 1.0 - ( 1.0 / float ( n ) ) )
	return int ( result )
for n in range ( 1 , 11 ) :
	print ( " phi ( " , n , " ) ▁ = ▁ " , phi ( n ) )