What are the divisors of 140?
1, 2, 4, 5, 7, 10, 14, 20, 28, 35, 70, 140
- There is a total of 12 positive divisors.
- The sum of these divisors is 336.
- The arithmetic mean is 28.
8 even divisors
2, 4, 10, 14, 20, 28, 70, 140
4 odd divisors
1, 5, 7, 35
How to compute the divisors of 140?
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 140 by each of the numbers from 1 to 140 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 140 / 1 = 140 (the remainder is 0, so 1 is a divisor of 140)
- 140 / 2 = 70 (the remainder is 0, so 2 is a divisor of 140)
- 140 / 3 = 46.666666666667 (the remainder is 2, so 3 is not a divisor of 140)
- ...
- 140 / 139 = 1.0071942446043 (the remainder is 1, so 139 is not a divisor of 140)
- 140 / 140 = 1 (the remainder is 0, so 140 is a divisor of 140)
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 140 (i.e. 11.832159566199). 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 )
- 140 / 1 = 140 (the remainder is 0, so 1 and 140 are divisors of 140)
- 140 / 2 = 70 (the remainder is 0, so 2 and 70 are divisors of 140)
- 140 / 3 = 46.666666666667 (the remainder is 2, so 3 is not a divisor of 140)
- ...
- 140 / 10 = 14 (the remainder is 0, so 10 and 14 are divisors of 140)
- 140 / 11 = 12.727272727273 (the remainder is 8, so 11 is not a divisor of 140)