What are the divisors of 1006?
1, 2, 503, 1006
- There is a total of 4 positive divisors.
- The sum of these divisors is 1512.
- The arithmetic mean is 378.
2 even divisors
2, 1006
2 odd divisors
1, 503
How to compute the divisors of 1006?
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 1006 by each of the numbers from 1 to 1006 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 1006 / 1 = 1006 (the remainder is 0, so 1 is a divisor of 1006)
- 1006 / 2 = 503 (the remainder is 0, so 2 is a divisor of 1006)
- 1006 / 3 = 335.33333333333 (the remainder is 1, so 3 is not a divisor of 1006)
- ...
- 1006 / 1005 = 1.0009950248756 (the remainder is 1, so 1005 is not a divisor of 1006)
- 1006 / 1006 = 1 (the remainder is 0, so 1006 is a divisor of 1006)
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 1006 (i.e. 31.717503054307). 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 )
- 1006 / 1 = 1006 (the remainder is 0, so 1 and 1006 are divisors of 1006)
- 1006 / 2 = 503 (the remainder is 0, so 2 and 503 are divisors of 1006)
- 1006 / 3 = 335.33333333333 (the remainder is 1, so 3 is not a divisor of 1006)
- ...
- 1006 / 30 = 33.533333333333 (the remainder is 16, so 30 is not a divisor of 1006)
- 1006 / 31 = 32.451612903226 (the remainder is 14, so 31 is not a divisor of 1006)