What are the divisors of 5004?
1, 2, 3, 4, 6, 9, 12, 18, 36, 139, 278, 417, 556, 834, 1251, 1668, 2502, 5004
- There is a total of 18 positive divisors.
- The sum of these divisors is 12740.
- The arithmetic mean is 707.77777777778.
12 even divisors
2, 4, 6, 12, 18, 36, 278, 556, 834, 1668, 2502, 5004
6 odd divisors
1, 3, 9, 139, 417, 1251
How to compute the divisors of 5004?
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 5004 by each of the numbers from 1 to 5004 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5004 / 1 = 5004 (the remainder is 0, so 1 is a divisor of 5004)
- 5004 / 2 = 2502 (the remainder is 0, so 2 is a divisor of 5004)
- 5004 / 3 = 1668 (the remainder is 0, so 3 is a divisor of 5004)
- ...
- 5004 / 5003 = 1.000199880072 (the remainder is 1, so 5003 is not a divisor of 5004)
- 5004 / 5004 = 1 (the remainder is 0, so 5004 is a divisor of 5004)
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 5004 (i.e. 70.73895673531). 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 )
- 5004 / 1 = 5004 (the remainder is 0, so 1 and 5004 are divisors of 5004)
- 5004 / 2 = 2502 (the remainder is 0, so 2 and 2502 are divisors of 5004)
- 5004 / 3 = 1668 (the remainder is 0, so 3 and 1668 are divisors of 5004)
- ...
- 5004 / 69 = 72.521739130435 (the remainder is 36, so 69 is not a divisor of 5004)
- 5004 / 70 = 71.485714285714 (the remainder is 34, so 70 is not a divisor of 5004)