What are the divisors of 138?
1, 2, 3, 6, 23, 46, 69, 138
- There is a total of 8 positive divisors.
- The sum of these divisors is 288.
- The arithmetic mean is 36.
4 even divisors
2, 6, 46, 138
4 odd divisors
1, 3, 23, 69
How to compute the divisors of 138?
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 138 by each of the numbers from 1 to 138 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 138 / 1 = 138 (the remainder is 0, so 1 is a divisor of 138)
- 138 / 2 = 69 (the remainder is 0, so 2 is a divisor of 138)
- 138 / 3 = 46 (the remainder is 0, so 3 is a divisor of 138)
- ...
- 138 / 137 = 1.007299270073 (the remainder is 1, so 137 is not a divisor of 138)
- 138 / 138 = 1 (the remainder is 0, so 138 is a divisor of 138)
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 138 (i.e. 11.747340124471). 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 )
- 138 / 1 = 138 (the remainder is 0, so 1 and 138 are divisors of 138)
- 138 / 2 = 69 (the remainder is 0, so 2 and 69 are divisors of 138)
- 138 / 3 = 46 (the remainder is 0, so 3 and 46 are divisors of 138)
- ...
- 138 / 10 = 13.8 (the remainder is 8, so 10 is not a divisor of 138)
- 138 / 11 = 12.545454545455 (the remainder is 6, so 11 is not a divisor of 138)