What are the divisors of 804?
1, 2, 3, 4, 6, 12, 67, 134, 201, 268, 402, 804
- There is a total of 12 positive divisors.
- The sum of these divisors is 1904.
- The arithmetic mean is 158.66666666667.
8 even divisors
2, 4, 6, 12, 134, 268, 402, 804
4 odd divisors
1, 3, 67, 201
How to compute the divisors of 804?
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 804 by each of the numbers from 1 to 804 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 804 / 1 = 804 (the remainder is 0, so 1 is a divisor of 804)
- 804 / 2 = 402 (the remainder is 0, so 2 is a divisor of 804)
- 804 / 3 = 268 (the remainder is 0, so 3 is a divisor of 804)
- ...
- 804 / 803 = 1.0012453300125 (the remainder is 1, so 803 is not a divisor of 804)
- 804 / 804 = 1 (the remainder is 0, so 804 is a divisor of 804)
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 804 (i.e. 28.354893757516). 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 )
- 804 / 1 = 804 (the remainder is 0, so 1 and 804 are divisors of 804)
- 804 / 2 = 402 (the remainder is 0, so 2 and 402 are divisors of 804)
- 804 / 3 = 268 (the remainder is 0, so 3 and 268 are divisors of 804)
- ...
- 804 / 27 = 29.777777777778 (the remainder is 21, so 27 is not a divisor of 804)
- 804 / 28 = 28.714285714286 (the remainder is 20, so 28 is not a divisor of 804)