galois.divisors

galois.divisors(n: int) list[int]

Computes all positive integer divisors \(d\) of the integer \(n\) such that \(d\ |\ n\).

Parameters
n: int

An integer.

Returns

Sorted list of positive integer divisors \(d\) of \(n\).

Notes

The divisors() function finds all positive integer divisors or factors of \(n\), where the factors() function only finds the prime factors of \(n\).

Examples

In [1]: galois.divisors(0)
Out[1]: []

In [2]: galois.divisors(1)
Out[2]: [1]

In [3]: galois.divisors(24)
Out[3]: [1, 2, 3, 4, 6, 8, 12, 24]

In [4]: galois.divisors(-24)
Out[4]: [1, 2, 3, 4, 6, 8, 12, 24]

In [5]: galois.factors(24)
Out[5]: ([2, 3], [3, 1])

Last update: Apr 21, 2022