What are the divisors of 3138?
1, 2, 3, 6, 523, 1046, 1569, 3138
- There is a total of 8 positive divisors.
- The sum of these divisors is 6288.
- The arithmetic mean is 786.
4 even divisors
2, 6, 1046, 3138
4 odd divisors
1, 3, 523, 1569
How to compute the divisors of 3138?
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 3138 by each of the numbers from 1 to 3138 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 3138 / 1 = 3138 (the remainder is 0, so 1 is a divisor of 3138)
- 3138 / 2 = 1569 (the remainder is 0, so 2 is a divisor of 3138)
- 3138 / 3 = 1046 (the remainder is 0, so 3 is a divisor of 3138)
- ...
- 3138 / 3137 = 1.0003187759005 (the remainder is 1, so 3137 is not a divisor of 3138)
- 3138 / 3138 = 1 (the remainder is 0, so 3138 is a divisor of 3138)
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 3138 (i.e. 56.017854296644). 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 )
- 3138 / 1 = 3138 (the remainder is 0, so 1 and 3138 are divisors of 3138)
- 3138 / 2 = 1569 (the remainder is 0, so 2 and 1569 are divisors of 3138)
- 3138 / 3 = 1046 (the remainder is 0, so 3 and 1046 are divisors of 3138)
- ...
- 3138 / 55 = 57.054545454545 (the remainder is 3, so 55 is not a divisor of 3138)
- 3138 / 56 = 56.035714285714 (the remainder is 2, so 56 is not a divisor of 3138)