What are the divisors of 5009?
1, 5009
- There is a total of 2 positive divisors.
- The sum of these divisors is 5010.
- The arithmetic mean is 2505.
2 odd divisors
1, 5009
How to compute the divisors of 5009?
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 5009 by each of the numbers from 1 to 5009 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5009 / 1 = 5009 (the remainder is 0, so 1 is a divisor of 5009)
- 5009 / 2 = 2504.5 (the remainder is 1, so 2 is not a divisor of 5009)
- 5009 / 3 = 1669.6666666667 (the remainder is 2, so 3 is not a divisor of 5009)
- ...
- 5009 / 5008 = 1.0001996805112 (the remainder is 1, so 5008 is not a divisor of 5009)
- 5009 / 5009 = 1 (the remainder is 0, so 5009 is a divisor of 5009)
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 5009 (i.e. 70.774289116882). 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 )
- 5009 / 1 = 5009 (the remainder is 0, so 1 and 5009 are divisors of 5009)
- 5009 / 2 = 2504.5 (the remainder is 1, so 2 is not a divisor of 5009)
- 5009 / 3 = 1669.6666666667 (the remainder is 2, so 3 is not a divisor of 5009)
- ...
- 5009 / 69 = 72.594202898551 (the remainder is 41, so 69 is not a divisor of 5009)
- 5009 / 70 = 71.557142857143 (the remainder is 39, so 70 is not a divisor of 5009)