What are the divisors of 420?
1, 2, 3, 4, 5, 6, 7, 10, 12, 14, 15, 20, 21, 28, 30, 35, 42, 60, 70, 84, 105, 140, 210, 420
- There is a total of 24 positive divisors.
- The sum of these divisors is 1344.
- The arithmetic mean is 56.
16 even divisors
2, 4, 6, 10, 12, 14, 20, 28, 30, 42, 60, 70, 84, 140, 210, 420
8 odd divisors
1, 3, 5, 7, 15, 21, 35, 105
How to compute the divisors of 420?
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 420 by each of the numbers from 1 to 420 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 420 / 1 = 420 (the remainder is 0, so 1 is a divisor of 420)
- 420 / 2 = 210 (the remainder is 0, so 2 is a divisor of 420)
- 420 / 3 = 140 (the remainder is 0, so 3 is a divisor of 420)
- ...
- 420 / 419 = 1.0023866348449 (the remainder is 1, so 419 is not a divisor of 420)
- 420 / 420 = 1 (the remainder is 0, so 420 is a divisor of 420)
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 420 (i.e. 20.493901531919). 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 )
- 420 / 1 = 420 (the remainder is 0, so 1 and 420 are divisors of 420)
- 420 / 2 = 210 (the remainder is 0, so 2 and 210 are divisors of 420)
- 420 / 3 = 140 (the remainder is 0, so 3 and 140 are divisors of 420)
- ...
- 420 / 19 = 22.105263157895 (the remainder is 2, so 19 is not a divisor of 420)
- 420 / 20 = 21 (the remainder is 0, so 20 and 21 are divisors of 420)