Python | sympy.divisors() method Last Updated : 05 Sep, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report With the help of sympy.divisors() method, we can find all the divisors of a given number in sorted order by default. Syntax: divisors(n, generator=False) Parameter: n - It denotes an integer. generator - If generator is True an unordered generator object is returned, otherwise it returns a sorted list of divisors. It is False by default. Returns: Returns a list of all the divisors of the given integer. Example #1: Python3 # import divisors() method from sympy from sympy import divisors n = 84 # Use divisors() method divisors_n = divisors(n) print("The divisors of {} : {}".format(n, divisors_n)) Output: The divisors of 84 : [1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, 84] Example #2: Python3 # import divisors() method from sympy from sympy import divisors n = -210 # Use divisors() method divisors_n = list(divisors(n, generator = True)) print("The divisors of {} : {}".format(n, divisors_n)) Output: The divisors of -210 : [1, 2, 3, 6, 5, 10, 15, 30, 7, 14, 21, 42, 35, 70, 105, 210] Comment More infoAdvertise with us Next Article Python | sympy.divisors() method R rupesh_rao Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads Python | sympy.divisor_count() method With the help of sympy.divisor_count() method, we can count the number of divisors of the given integer. Syntax: divisor_count(n, modulus=1) Parameter: n - It denotes an integer. modulus - It is set to 1 by default. If modulus is not 1 then only those that are divisible by modulus are counted. Retur 1 min read Python | sympy.divisor_sigma() method With the help of sympy.divisor_sigma() method, we can find the divisor function \sigma_k(n) for positive integer n. divisor_sigma(n, k) is equal to the sum of all the divisors of n raised to the power of k or sum([x**k for x in divisors(n)]). Syntax: divisor_sigma(n, k) Parameter: n - It denotes an 1 min read Python | sympy.core() method With the help of sympy.core() method, we can calculate the core_t(n) of a positive integer n. core(n, t) calculates the t-th power free part of n. If nâs prime factorization is : n = \prod_{i=1}^\omega p_i^{m_i} then core_t(n) = \prod_{i=1}^\omega p_i^{m_i \mod t} Syntax: core(n, t=2) Parameter: n - 1 min read Python | sympy.antidivisor_count() method With the help of sympy.antidivisor_count() method, we can find the count of anti-divisors of a given integer. Syntax: antidivisor_count(n) Parameter: n - It denotes an integer. Returns: Returns the count of anti-divisors of the given integer. Example #1: Python3 # import antidivisor_count() method f 1 min read Python | sympy.gcd() method The function gcd() provides the direct way to compute Greatest Common Divisor for polynomials.That is, for polynomials f and g, it computes GCD. Syntax: sympy.gcd(f, g) Return: GCD of given polynomials Example #1: Python3 1== # import sympy from sympy import * f = (12 * x + 12)*x g = 32 * x**2 # Usi 1 min read Like