What are the divisors of 3126?
1, 2, 3, 6, 521, 1042, 1563, 3126
- There is a total of 8 positive divisors.
- The sum of these divisors is 6264.
- The arithmetic mean is 783.
4 even divisors
2, 6, 1042, 3126
4 odd divisors
1, 3, 521, 1563
How to compute the divisors of 3126?
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 3126 by each of the numbers from 1 to 3126 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 3126 / 1 = 3126 (the remainder is 0, so 1 is a divisor of 3126)
- 3126 / 2 = 1563 (the remainder is 0, so 2 is a divisor of 3126)
- 3126 / 3 = 1042 (the remainder is 0, so 3 is a divisor of 3126)
- ...
- 3126 / 3125 = 1.00032 (the remainder is 1, so 3125 is not a divisor of 3126)
- 3126 / 3126 = 1 (the remainder is 0, so 3126 is a divisor of 3126)
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 3126 (i.e. 55.910642993977). 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 )
- 3126 / 1 = 3126 (the remainder is 0, so 1 and 3126 are divisors of 3126)
- 3126 / 2 = 1563 (the remainder is 0, so 2 and 1563 are divisors of 3126)
- 3126 / 3 = 1042 (the remainder is 0, so 3 and 1042 are divisors of 3126)
- ...
- 3126 / 54 = 57.888888888889 (the remainder is 48, so 54 is not a divisor of 3126)
- 3126 / 55 = 56.836363636364 (the remainder is 46, so 55 is not a divisor of 3126)