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