Monday, October 6, 2025
HomeLanguagesPython | sympy.antidivisors() method

Python | sympy.antidivisors() method

With the help of sympy.antidivisors() method, we can find the anti-divisors of a given number in sorted order by default.

Syntax: antidivisors(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 anti-divisors. It is False by default.

Returns: Returns a list of anti-divisors of the given integer.

Example #1:




# import antidivisors() method from sympy
from sympy.ntheory.factor_ import antidivisors
  
n = 24
  
# Use antidivisors() method 
antidivisors_n = antidivisors(n) 
      
print("The anti-divisors of {} : {}".format(n, antidivisors_n))


Output:

The anti-divisors of 24 : [7, 16]

Example #2:




# import antidivisors() method from sympy
from sympy.ntheory.factor_ import antidivisors
  
n = 128
  
# Use antidivisors() method 
antidivisors_n = antidivisors(n) 
      
print("The anti-divisors of {} : {}".format(n, antidivisors_n))


Output:

The anti-divisors of 128 : [3, 5, 15, 17, 51, 85]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32338 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6707 POSTS0 COMMENTS
Nicole Veronica
11871 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6825 POSTS0 COMMENTS
Ted Musemwa
7089 POSTS0 COMMENTS
Thapelo Manthata
6779 POSTS0 COMMENTS
Umr Jansen
6781 POSTS0 COMMENTS