What are the divisors of 125?
1, 5, 25, 125
- There is a total of 4 positive divisors.
- The sum of these divisors is 156.
- The arithmetic mean is 39.
4 odd divisors
1, 5, 25, 125
How to compute the divisors of 125?
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 125 by each of the numbers from 1 to 125 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 125 / 1 = 125 (the remainder is 0, so 1 is a divisor of 125)
- 125 / 2 = 62.5 (the remainder is 1, so 2 is not a divisor of 125)
- 125 / 3 = 41.666666666667 (the remainder is 2, so 3 is not a divisor of 125)
- ...
- 125 / 124 = 1.008064516129 (the remainder is 1, so 124 is not a divisor of 125)
- 125 / 125 = 1 (the remainder is 0, so 125 is a divisor of 125)
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 125 (i.e. 11.180339887499). 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 )
- 125 / 1 = 125 (the remainder is 0, so 1 and 125 are divisors of 125)
- 125 / 2 = 62.5 (the remainder is 1, so 2 is not a divisor of 125)
- 125 / 3 = 41.666666666667 (the remainder is 2, so 3 is not a divisor of 125)
- ...
- 125 / 10 = 12.5 (the remainder is 5, so 10 is not a divisor of 125)
- 125 / 11 = 11.363636363636 (the remainder is 4, so 11 is not a divisor of 125)