What are the divisors of 5022?
1, 2, 3, 6, 9, 18, 27, 31, 54, 62, 81, 93, 162, 186, 279, 558, 837, 1674, 2511, 5022
- There is a total of 20 positive divisors.
- The sum of these divisors is 11616.
- The arithmetic mean is 580.8.
10 even divisors
2, 6, 18, 54, 62, 162, 186, 558, 1674, 5022
10 odd divisors
1, 3, 9, 27, 31, 81, 93, 279, 837, 2511
How to compute the divisors of 5022?
A number N is said to be divisible by a number M (with M non-zero) if, when we divide N by M, the remainder of the division is zero.
Brute force algorithm
We could start by using a brute-force method which would involve dividing 5022 by each of the numbers from 1 to 5022 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5022 / 1 = 5022 (the remainder is 0, so 1 is a divisor of 5022)
- 5022 / 2 = 2511 (the remainder is 0, so 2 is a divisor of 5022)
- 5022 / 3 = 1674 (the remainder is 0, so 3 is a divisor of 5022)
- ...
- 5022 / 5021 = 1.0001991635132 (the remainder is 1, so 5021 is not a divisor of 5022)
- 5022 / 5022 = 1 (the remainder is 0, so 5022 is a divisor of 5022)
Improved algorithm using square-root
However, there is another slightly better approach that reduces the number of iterations by testing only integers less than or equal to the square root of 5022 (i.e. 70.866070866106). Indeed, if a number N has a divisor D greater than its square root, then there is necessarily a smaller divisor d such that:
(thus, if , then )
- 5022 / 1 = 5022 (the remainder is 0, so 1 and 5022 are divisors of 5022)
- 5022 / 2 = 2511 (the remainder is 0, so 2 and 2511 are divisors of 5022)
- 5022 / 3 = 1674 (the remainder is 0, so 3 and 1674 are divisors of 5022)
- ...
- 5022 / 69 = 72.782608695652 (the remainder is 54, so 69 is not a divisor of 5022)
- 5022 / 70 = 71.742857142857 (the remainder is 52, so 70 is not a divisor of 5022)