Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I'm looking for a formula to calculate the product of all proper divisors of a number number $n$. Any idea?


share|cite|improve this question

marked as duplicate by Martin Sleziak, studiosus, Claude Leibovici, Davide Giraudo, Jonas Meyer Sep 14 '14 at 18:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

If $d_1|n$ so does $\frac{n}{d_1}$. So this essentially boils down to counting the number of divisors. Do you count the $\sqrt{n}$ twice if $n$ is a perfect square? – user17762 Feb 28 '11 at 1:35
@Sivaram Ambikasaran: Sorry, I'm really not sure, but I believe it should be. Very good point! – Chan Feb 28 '11 at 1:41
See also:… – Martin Sleziak Sep 14 '14 at 11:22
up vote 9 down vote accepted

Like Sivaram points out. If $n$ is not a perfect square, then every divisor $d_1$ can be paired with the divisor $\frac{n}{d_1}$, which is distinct from $d_1$; the product of these two is $n$. So the product of all divisors is equal to $n^k$, where $2k$ is the number of divisors. (Note that a positive integer has an odd number of distinct divisors if and only if it is a square).

If $n$ is a perfect square, then it will have $2k+1$ divisors for some $k$; the product will be $n^k\times\sqrt{n} = n^{k+\frac{1}{2}}$.

Either way, the answer is $n^{d(n)/2}$, where $d(n)$ is the number of divisors of $n$ (sometimes written $\sigma_0(n)$ or $\tau(n)$).

If you want the proper divisors, then you are excluding $n$ from the product, so the answer becomes $n^{(d(n)/2) - 1}$.

share|cite|improve this answer
@lhf: Wouldn't it make more sense to have this as a comment to the original question? – Arturo Magidin Feb 28 '11 at 1:46
Thanks, I got it. – Chan Feb 28 '11 at 1:48

We are meant to calculate,

$$ \prod_{t|n}t, t\neq n $$

We will calculate including $t=n$, and will divide the result finally by $n$.

Using fundamental theorem of arithmetic,

$$ n=p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k} $$

where $p_j$ is a prime number. Now if $p^a$ is an entry in the above, number of terms in above product containing $p^{a'}$ is $d(n)/(a+1)$, where $d(n)$ denotes the number of positive divisors of number $n$. Thus in above product, contribution out of prime $p$ is

$$ p^{(1+2+\cdots +a)*d(n)/(a+1)}=(p^a)^{d(n)/2} $$


$$ \prod_{t|n}t=(p_1^{a_1})^{d(n)/2}(p_2^{a_2})^{d(n)/2}\cdots (p_k^{a_k})^{d(n)/2}=n^{d(n)/2} $$

Division by $n$ gives,

$$ n^{\frac{d(n)}{2}-1} $$

share|cite|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.