The Student Room Group

Formulae to add all the factors of a number?

Is there any? For instance, I have number 5400, 5400 = 2^3*3^3*5^2. I can add up all the single factors, that are

1 2 3 4 5 6 8 9 10 12 15 18 20 24 25 27 30 36 40 45 50 54 60 72 75 90 100 108 120 135 150 180 200 216 225 270 300 360 450 540 600 675 900 1080 1350 1800 2700 5400

though that would be time-inefficient. Is there any formulae that would be helpful in this situation?

Cheers,
John
So far as I know, there's no closed form expression for what you're asking, though it wouldn't be too difficult to write a computer program to do it for you.

May I ask why you're doing this?
Reply 2
There's a maths challenge at my school and the task involves adding all the factors. Um, I have come across this formulae, can someone verify whether it works?

if a positive integer is denoted in prime numbers as

n=(ap)×(bq)×(cr)n = (a^p) \times (b^q) \times (c^r)

then a sum of the factors is:

(ap+11)×(bq+11)×(cr+11)2\frac{(a^{p+1}-1) \times (b^{q+1}-1) \times (c^{r+1}-1)}{2}

e.g.

n=12=22×31n = 12 = 2^{2} \times 3^{1}

sum of factors:

(231)×(321)2=28\frac {(2^3 - 1) \times (3^2 - 1)}{2} = 28

factors:

1, 2, 3, 4, 6, 12

sum of factors = 28

Seems to work, does it really?

Cheers,
John
Reply 3
Doesn't appear to work for n=4?
Reply 4
Oops, chose two numbers and worked. Seems it doesn't work for all numbers then. Um, oh wells, will have to carry on thinking :smile:
If you know the number of prime factors it has, that will give you the number of overall factors won't it? (permutations of the prime factors)

I can't think how you'd extend that to adding them all up though...
Reply 6
There is a function which does this: the divisor function. It is an "arithmetic" function which means it takes values of natural numbers to complex numbers (other natural numbers in this case)

We can investigate the properties of it.

As it turns out, the divisor function is multiplicative, which means that σ(ab)=σ(a)σ(b)\sigma (ab) = \sigma ( a)\sigma (b) when a and b are coprime. This means we just need to find σ\sigma for prime values.

As it happens, when we do this, we can prove that the formula is:

σ(n)=i=1rpi(ai+1)1pi1\displaystyle \boxed{ \sigma(n) = \prod_{i=1}^{r} \frac{p_{i}^{(a_{i}+1)}-1}{p_{i}-1}} where n=i=1rpiai\displaystyle n = \prod_{i=1}^{r}p_{i}^{a_{i}}

i=1nai=a1×a2×a3××an\displaystyle \prod_{i=1}^n a_i = a_1 \times a_2 \times a_3 \times \cdots \times a_n is just the product (over the prime divisors in this case)
Reply 7
jonny23563
If you know the number of prime factors it has, that will give you the number of overall factors won't it? (permutations of the prime factors)

I can't think how you'd extend that to adding them all up though...

n=(ap)×(bq)×(cr)n = (a^p) \times (b^q) \times (c^r)

number of overall factors:

n=(p+1)×(q+1)×(c+1)n = (p+1) \times (q+1) \times (c+1)

Should be correct?

And still there are some sites on the web that provides you with that, that is calculation of all the factors and denoting the number into a powers of primes form.

Adding the values of factors is bit trickier though. Can do that manually, but hoping that there is a quicker way :smile:
Reply 8
goldsilvy
n=(ap)×(bq)×(cr)n = (a^p) \times (b^q) \times (c^r)

number of overall factors:

n=(p+1)×(q+1)×(c+1)n = (p+1) \times (q+1) \times (c+1)

Should be correct?


Correct (when a,b and c are the three prime divisors, but we can extend that idea easily :smile: )
Reply 9
SimonM
There is a function which does this: the divisor function. It is an "arithmetic" function which means it takes values of natural numbers to complex numbers (other natural numbers in this case)

We can investigate the properties of it.

As it turns out, the divisor function is multiplicative, which means that σ(ab)=σ(a)σ(b)\sigma (ab) = \sigma ( a)\sigma (b) when a and b are coprime. This means we just need to find σ\sigma for prime values.

As it happens, when we do this, we can prove that the formula is:

σ(n)=i=1rpi(ai+1)1pi1\displaystyle \boxed{ \sigma(n) = \prod_{i=1}^{r} \frac{p_{i}^{(a_{i}+1)}-1}{p_{i}-1}} where n=i=1rpiai\displaystyle n = \prod_{i=1}^{r}p_{i}^{a_{i}}

i=1nai=a1×a2×a3××an\displaystyle \prod_{i=1}^n a_i = a_1 \times a_2 \times a_3 \times \cdots \times a_n is just the product (over the prime divisors in this case)


Sorry for sounding kinda stupid, but can you give me an example of the formula above in practice, please? Using my common sense mostly, and currently taking only A-Level Maths, so my mathematical knowledge is very limited :smile:
Reply 10
goldsilvy
Sorry for sounding kinda stupid, but can you give me an example of the formula above in practice, please? Using my common sense mostly, and currently taking only A-Level Maths, so my mathematical knowledge is very limited :smile:


Of course: Take n=1960=23572n = 1960 = 2^3 \cdot 5 \cdot 7^2

Therefore σ(1960)=(23+1121)(51+1151)(72+1171)=15657=5130\displaystyle \sigma(1960) = \left ( \frac{2^{3+1}-1}{2-1} \right ) \left ( \frac{5^{1+1}-1}{5-1} \right ) \left ( \frac{7^{2+1}-1}{7-1} \right ) = 15 \cdot 6 \cdot 57 = \boxed{5130}

To see where it comes from;

σ(pn)=1+p+p2+p3++pn=pn+11p1\displaystyle \sigma (p^n) = 1+p+p^2+p^3+\cdots +p^n = \frac{p^{n+1}-1}{p-1} using the sum of a geometric progression. (When p is prime)
Reply 11
SimonM
Of course: Take n=1960=23572n = 1960 = 2^3 \cdot 5 \cdot 7^2

Therefore σ(1960)=(23+1121)(51+1151)(72+1171)=15657=5130\displaystyle \sigma(1960) = \left ( \frac{2^{3+1}-1}{2-1} \right ) \left ( \frac{5^{1+1}-1}{5-1} \right ) \left ( \frac{7^{2+1}-1}{7-1} \right ) = 15 \cdot 6 \cdot 57 = \boxed{5130}

To see where it comes from;

σ(pn)=1+p+p2+p3++pn=pn+11p1\displaystyle \sigma (p^n) = 1+p+p^2+p^3+\cdots +p^n = \frac{p^{n+1}-1}{p-1} using the sum of a geometric progression. (When p is prime)

Huge thanks! :smile:

Latest