What are the divisors of 5040?
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 28, 30, 35, 36, 40, 42, 45, 48, 56, 60, 63, 70, 72, 80, 84, 90, 105, 112, 120, 126, 140, 144, 168, 180, 210, 240, 252, 280, 315, 336, 360, 420, 504, 560, 630, 720, 840, 1008, 1260, 1680, 2520, 5040
- There is a total of 60 positive divisors.
- The sum of these divisors is 19344.
- The arithmetic mean is 322.4.
48 even divisors
2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 24, 28, 30, 36, 40, 42, 48, 56, 60, 70, 72, 80, 84, 90, 112, 120, 126, 140, 144, 168, 180, 210, 240, 252, 280, 336, 360, 420, 504, 560, 630, 720, 840, 1008, 1260, 1680, 2520, 5040
12 odd divisors
1, 3, 5, 7, 9, 15, 21, 35, 45, 63, 105, 315
How to compute the divisors of 5040?
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 5040 by each of the numbers from 1 to 5040 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5040 / 1 = 5040 (the remainder is 0, so 1 is a divisor of 5040)
- 5040 / 2 = 2520 (the remainder is 0, so 2 is a divisor of 5040)
- 5040 / 3 = 1680 (the remainder is 0, so 3 is a divisor of 5040)
- ...
- 5040 / 5039 = 1.0001984520738 (the remainder is 1, so 5039 is not a divisor of 5040)
- 5040 / 5040 = 1 (the remainder is 0, so 5040 is a divisor of 5040)
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 5040 (i.e. 70.992957397195). 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 )
- 5040 / 1 = 5040 (the remainder is 0, so 1 and 5040 are divisors of 5040)
- 5040 / 2 = 2520 (the remainder is 0, so 2 and 2520 are divisors of 5040)
- 5040 / 3 = 1680 (the remainder is 0, so 3 and 1680 are divisors of 5040)
- ...
- 5040 / 69 = 73.04347826087 (the remainder is 3, so 69 is not a divisor of 5040)
- 5040 / 70 = 72 (the remainder is 0, so 70 and 72 are divisors of 5040)