What are the divisors of 1008?
1, 2, 3, 4, 6, 7, 8, 9, 12, 14, 16, 18, 21, 24, 28, 36, 42, 48, 56, 63, 72, 84, 112, 126, 144, 168, 252, 336, 504, 1008
- There is a total of 30 positive divisors.
- The sum of these divisors is 3224.
- The arithmetic mean is 107.46666666667.
24 even divisors
2, 4, 6, 8, 12, 14, 16, 18, 24, 28, 36, 42, 48, 56, 72, 84, 112, 126, 144, 168, 252, 336, 504, 1008
6 odd divisors
1, 3, 7, 9, 21, 63
How to compute the divisors of 1008?
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 1008 by each of the numbers from 1 to 1008 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 1008 / 1 = 1008 (the remainder is 0, so 1 is a divisor of 1008)
- 1008 / 2 = 504 (the remainder is 0, so 2 is a divisor of 1008)
- 1008 / 3 = 336 (the remainder is 0, so 3 is a divisor of 1008)
- ...
- 1008 / 1007 = 1.0009930486594 (the remainder is 1, so 1007 is not a divisor of 1008)
- 1008 / 1008 = 1 (the remainder is 0, so 1008 is a divisor of 1008)
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 1008 (i.e. 31.749015732775). 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 )
- 1008 / 1 = 1008 (the remainder is 0, so 1 and 1008 are divisors of 1008)
- 1008 / 2 = 504 (the remainder is 0, so 2 and 504 are divisors of 1008)
- 1008 / 3 = 336 (the remainder is 0, so 3 and 336 are divisors of 1008)
- ...
- 1008 / 30 = 33.6 (the remainder is 18, so 30 is not a divisor of 1008)
- 1008 / 31 = 32.516129032258 (the remainder is 16, so 31 is not a divisor of 1008)