What are the divisors of 3140?
1, 2, 4, 5, 10, 20, 157, 314, 628, 785, 1570, 3140
- There is a total of 12 positive divisors.
- The sum of these divisors is 6636.
- The arithmetic mean is 553.
8 even divisors
2, 4, 10, 20, 314, 628, 1570, 3140
4 odd divisors
1, 5, 157, 785
How to compute the divisors of 3140?
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 3140 by each of the numbers from 1 to 3140 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 3140 / 1 = 3140 (the remainder is 0, so 1 is a divisor of 3140)
- 3140 / 2 = 1570 (the remainder is 0, so 2 is a divisor of 3140)
- 3140 / 3 = 1046.6666666667 (the remainder is 2, so 3 is not a divisor of 3140)
- ...
- 3140 / 3139 = 1.0003185727939 (the remainder is 1, so 3139 is not a divisor of 3140)
- 3140 / 3140 = 1 (the remainder is 0, so 3140 is a divisor of 3140)
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 3140 (i.e. 56.035702904488). 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 )
- 3140 / 1 = 3140 (the remainder is 0, so 1 and 3140 are divisors of 3140)
- 3140 / 2 = 1570 (the remainder is 0, so 2 and 1570 are divisors of 3140)
- 3140 / 3 = 1046.6666666667 (the remainder is 2, so 3 is not a divisor of 3140)
- ...
- 3140 / 55 = 57.090909090909 (the remainder is 5, so 55 is not a divisor of 3140)
- 3140 / 56 = 56.071428571429 (the remainder is 4, so 56 is not a divisor of 3140)