and as to how u get the formula look here:
Consider a number N which has been factorised as
N = x1p x2q x3r x4s...
where each xi is prime
Now consider
(1+x1+x12+...+x1p) (1+x2+x22+...+x2q) (1+x3+x32+...+x3r)(1+x4+x42+...+x4r)
Clearly, the powers of different xi.vary from 0 to p,q,r in each term and each term will have a combination of all the xis
this expansion contains all divisors of the number N and hence is the sum
of all the divisors