How to find all positive divisors of a given number?
For example, I have to find all positive divisors of $372$. The prime factorization of $372$ is $2^2 \cdot 3 \cdot 31$
Now, I wonder if there is a fast method to find all positive divisors of $372$.
$\endgroup$ 11 Answer
$\begingroup$Once you have the prime factorization of a number, say $$n=p_1^{n_1}\cdot p_2^{n_2}\cdots p_{r}^{n_r},$$ then any positive divisors $d$ of $n$ can be written as $$d=p_1^{x_1}\cdot p_2^{x_2}\cdots p_{r}^{x_r}$$ where each exponent $x_i$ is a non-negative integer less or equal to $n_i$. The number of such divisors is equal to the product $(n_1+1)\cdot (n_2+1)\cdots (n_r+1)$.
In your example $n=372=2^2 \cdot 3^1 \cdot 31^1$ and therefore the divisors are $3\cdot 2\cdot 2=12$ and they are $$2^0 \cdot 3^0 \cdot 31^0$$ $$2^0 \cdot 3^0 \cdot 31^1$$ $$2^0 \cdot 3^1 \cdot 31^0$$ $$2^0 \cdot 3^1 \cdot 31^1$$ $$2^1 \cdot 3^0 \cdot 31^0$$ $$2^1 \cdot 3^0 \cdot 31^1$$ $$2^1 \cdot 3^1 \cdot 31^0$$ $$2^1 \cdot 3^1 \cdot 31^1$$ $$2^2 \cdot 3^0 \cdot 31^0$$ $$2^2 \cdot 3^0 \cdot 31^1$$ $$2^2 \cdot 3^1 \cdot 31^0$$ $$2^2 \cdot 3^1 \cdot 31^1$$
$\endgroup$ 9