The sum of divisors of a number
To find the sum of all the divisors of a number, we will start with the formulae we used to find the number of divisors.
As we know, if a number F appears p times in the prime factorization of a number X, it can appear in subsets in p+1 ways, i.e., Now, if we multiply the set of choices of each factor, we will get a set of all possible divisors.
For example, if we have a number with two factors, then all the terms in the product will form the set containing all the divisors.
Since we need the sum of all the divisors of a number, we will find the product of the sum of all the choices for each factor. For the above example- the will represent the sum of all the divisors of a number.
So, for any number, the sum of all the divisors of a number will be
In this expression, we can observe that each term in the product is a GP. and for any GP, the sum of all the terms is
Using this for every term in the formula
We will get the result as-
Check out this problem - Maximum Product Subarray
Frequently Asked Questions
How can you find the total no. of divisors of a number?
To find the total number of divisors of a number, we first find the prime factorization of the number and then find each distinct prime number's exponents. Then we add one to all the exponents and then find their product. The product is the number of divisors of a number.
What is the multiplicative identity?
Multiplicative identity states that the product of any number with 1 is the number itself. Thus, we can also say that one is a divisor of every number.
How do you find the number of odd divisors of a number?
To find the number of odd divisors of a number, we first find the prime factorization of the number and then find each distinct prime number's exponents. Now, we remove even prime numbers in it. Then we add one to all the exponents of odd prime numbers and then find their product. The product is the number of odd divisors of a number.
How do you find the number of odd divisors of a number?
Since we know how to find the total number of divisors of a number and odd divisors of a number, the difference of both will be the even divisors of a number.
What are the proper divisors of a number?
The proper divisors of a number refer to the divisors, which are smaller than the number itself.
Conclusion
In this blog, we have learned the formula for the number of divisors of a number and the sum of divisors of a number-
- We learned about the formula to find the number of divisors of a number because any divisor of a number will be formed by selecting some factors from the prime factorization of the number. Then we found that the number of choices for each factor in forming another divisor is one more than the number of times it appears in the prime factorization of the number. Thus, the total number of choices for each factor gives us the total number of divisors of a number.
- Then we learned about the formula to find the sum of divisors of a number using the similar concept we used for finding the number of divisors of a number. Since the product of all the choices for each factor for forming a divisor gives the total number of divisors. So, we find the product of the sum of the total number of choices for each distinct factor in the prime factorization of the number, which gives us the sum of all the number's divisors.
Visit here to learn more about algorithms in programming. You can also practice similar questions on Code studio.