What are the divisors of 945?
1, 3, 5, 7, 9, 15, 21, 27, 35, 45, 63, 105, 135, 189, 315, 945
- There is a total of 16 positive divisors.
- The sum of these divisors is 1920.
- The arithmetic mean is 120.
16 odd divisors
1, 3, 5, 7, 9, 15, 21, 27, 35, 45, 63, 105, 135, 189, 315, 945
How to compute the divisors of 945?
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 945 by each of the numbers from 1 to 945 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 945 / 1 = 945 (the remainder is 0, so 1 is a divisor of 945)
- 945 / 2 = 472.5 (the remainder is 1, so 2 is not a divisor of 945)
- 945 / 3 = 315 (the remainder is 0, so 3 is a divisor of 945)
- ...
- 945 / 944 = 1.0010593220339 (the remainder is 1, so 944 is not a divisor of 945)
- 945 / 945 = 1 (the remainder is 0, so 945 is a divisor of 945)
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 945 (i.e. 30.740852297879). 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 )
- 945 / 1 = 945 (the remainder is 0, so 1 and 945 are divisors of 945)
- 945 / 2 = 472.5 (the remainder is 1, so 2 is not a divisor of 945)
- 945 / 3 = 315 (the remainder is 0, so 3 and 315 are divisors of 945)
- ...
- 945 / 29 = 32.586206896552 (the remainder is 17, so 29 is not a divisor of 945)
- 945 / 30 = 31.5 (the remainder is 15, so 30 is not a divisor of 945)