Python | sympy.totient() method Last Updated : 17 Sep, 2019 Comments Improve Suggest changes Like Article Like Report With the help of sympy.totient() method, we can find Euler totient function or phi(n) of a given integer. Euler totient function is the number of positive integers less than or equal to a given integer that are relatively prime to it. In other words, it is the number of integers k in the range 1 <= k <= n for which the greatest common divisor gcd(n, k) is equal to 1. Syntax: totient(n) Parameter: n - It denotes an integer. Returns: Returns the number of integers less than or equal to that integer n that are relatively prime to it. Example #1: Python3 # import totient() method from sympy from sympy.ntheory.factor_ import totient n = 24 # Use totient() method totient_n = totient(n) print("phi({}) = {} ".format(n, totient_n)) # 1 5 7 11 13 17 19 23 Output: phi(24) = 8 Example #2: Python3 # import totient() method from sympy from sympy.ntheory.factor_ import totient n = 19 # Use totient() method totient_n = totient(n) print("phi({}) = {} ".format(n, totient_n)) Output: phi(19) = 18 Comment More infoAdvertise with us Next Article Python | sympy.totient() method R rupesh_rao Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads Python | sympy.reduced_totient() method With the help of sympy.reduced_totient() method, we can find the Carmichael reduced totient function or lambda(n) in SymPy. reduced_totient(n) or \lambda(n) is the smallest m > 0 such that k^m \equiv 1 \mod n for all k relatively prime to n. Syntax: reduced_totient(n) Parameter: n - It denotes an 1 min read Python sympy | sieve.totientrange() method With the help of sympy.sieve.totientrange() method, we can generate all totient numbers for a given range [a, b). It returns a type generator object which can be converted to a list for further operations. Syntax: sieve.totientrange(a, b) Parameters: a - It denotes the start of the range. It is incl 1 min read Python | sympy.crt() method With the help of sympy.crt() method, we can implement the Chinese Remainder Theorem in SymPy. Syntax: crt(m, v) Parameter: m - It denotes a list of integers. v - It denotes a list of integers. Returns: Returns a tuple of integers where the first element is the required result. Example #1: Python3 # 1 min read Python | sympy.lcm() method With the help of sympy.lcm() method, we can find the least common multiple of two numbers that is passed as a parameter in the sympy.lcm() method. Syntax : sympy.lcm(var1, var2) Return : Return value of least common multiple. Example #1 : In this example we can see that by using sympy.lcm() method, 1 min read Python | sympy.Mod() method With the help of sympy.Mod() method, we can find the modulus and can give the parameters separately by using sympy.Mod() method. Syntax : sympy.Mod(var1, var2) Return : Return a value of modulo. Example #1 : In this example we can see that by using sympy.Mod() method, we are able to find the modulus 1 min read Like