What are the divisors of 5140?
1, 2, 4, 5, 10, 20, 257, 514, 1028, 1285, 2570, 5140
- There is a total of 12 positive divisors.
- The sum of these divisors is 10836.
- The arithmetic mean is 903.
8 even divisors
2, 4, 10, 20, 514, 1028, 2570, 5140
4 odd divisors
1, 5, 257, 1285
How to compute the divisors of 5140?
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 5140 by each of the numbers from 1 to 5140 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5140 / 1 = 5140 (the remainder is 0, so 1 is a divisor of 5140)
- 5140 / 2 = 2570 (the remainder is 0, so 2 is a divisor of 5140)
- 5140 / 3 = 1713.3333333333 (the remainder is 1, so 3 is not a divisor of 5140)
- ...
- 5140 / 5139 = 1.0001945903872 (the remainder is 1, so 5139 is not a divisor of 5140)
- 5140 / 5140 = 1 (the remainder is 0, so 5140 is a divisor of 5140)
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 5140 (i.e. 71.69379331574). 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 )
- 5140 / 1 = 5140 (the remainder is 0, so 1 and 5140 are divisors of 5140)
- 5140 / 2 = 2570 (the remainder is 0, so 2 and 2570 are divisors of 5140)
- 5140 / 3 = 1713.3333333333 (the remainder is 1, so 3 is not a divisor of 5140)
- ...
- 5140 / 70 = 73.428571428571 (the remainder is 30, so 70 is not a divisor of 5140)
- 5140 / 71 = 72.394366197183 (the remainder is 28, so 71 is not a divisor of 5140)