Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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


share|improve this 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

2 Answers 2

up vote 8 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|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|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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