What are the divisors of 304?
1, 2, 4, 8, 16, 19, 38, 76, 152, 304
- There is a total of 10 positive divisors.
- The sum of these divisors is 620.
- The arithmetic mean is 62.
8 even divisors
2, 4, 8, 16, 38, 76, 152, 304
2 odd divisors
1, 19
How to compute the divisors of 304?
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 304 by each of the numbers from 1 to 304 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 304 / 1 = 304 (the remainder is 0, so 1 is a divisor of 304)
- 304 / 2 = 152 (the remainder is 0, so 2 is a divisor of 304)
- 304 / 3 = 101.33333333333 (the remainder is 1, so 3 is not a divisor of 304)
- ...
- 304 / 303 = 1.003300330033 (the remainder is 1, so 303 is not a divisor of 304)
- 304 / 304 = 1 (the remainder is 0, so 304 is a divisor of 304)
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 304 (i.e. 17.435595774163). 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 )
- 304 / 1 = 304 (the remainder is 0, so 1 and 304 are divisors of 304)
- 304 / 2 = 152 (the remainder is 0, so 2 and 152 are divisors of 304)
- 304 / 3 = 101.33333333333 (the remainder is 1, so 3 is not a divisor of 304)
- ...
- 304 / 16 = 19 (the remainder is 0, so 16 and 19 are divisors of 304)
- 304 / 17 = 17.882352941176 (the remainder is 15, so 17 is not a divisor of 304)