What are the divisors of 942?
1, 2, 3, 6, 157, 314, 471, 942
- There is a total of 8 positive divisors.
- The sum of these divisors is 1896.
- The arithmetic mean is 237.
4 even divisors
2, 6, 314, 942
4 odd divisors
1, 3, 157, 471
How to compute the divisors of 942?
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 942 by each of the numbers from 1 to 942 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 942 / 1 = 942 (the remainder is 0, so 1 is a divisor of 942)
- 942 / 2 = 471 (the remainder is 0, so 2 is a divisor of 942)
- 942 / 3 = 314 (the remainder is 0, so 3 is a divisor of 942)
- ...
- 942 / 941 = 1.0010626992561 (the remainder is 1, so 941 is not a divisor of 942)
- 942 / 942 = 1 (the remainder is 0, so 942 is a divisor of 942)
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 942 (i.e. 30.692018506446). 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 )
- 942 / 1 = 942 (the remainder is 0, so 1 and 942 are divisors of 942)
- 942 / 2 = 471 (the remainder is 0, so 2 and 471 are divisors of 942)
- 942 / 3 = 314 (the remainder is 0, so 3 and 314 are divisors of 942)
- ...
- 942 / 29 = 32.48275862069 (the remainder is 14, so 29 is not a divisor of 942)
- 942 / 30 = 31.4 (the remainder is 12, so 30 is not a divisor of 942)