What are the divisors of 1978?
1, 2, 23, 43, 46, 86, 989, 1978
- There is a total of 8 positive divisors.
- The sum of these divisors is 3168.
- The arithmetic mean is 396.
4 even divisors
2, 46, 86, 1978
4 odd divisors
1, 23, 43, 989
How to compute the divisors of 1978?
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 1978 by each of the numbers from 1 to 1978 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 1978 / 1 = 1978 (the remainder is 0, so 1 is a divisor of 1978)
- 1978 / 2 = 989 (the remainder is 0, so 2 is a divisor of 1978)
- 1978 / 3 = 659.33333333333 (the remainder is 1, so 3 is not a divisor of 1978)
- ...
- 1978 / 1977 = 1.0005058168943 (the remainder is 1, so 1977 is not a divisor of 1978)
- 1978 / 1978 = 1 (the remainder is 0, so 1978 is a divisor of 1978)
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 1978 (i.e. 44.474711915874). 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 )
- 1978 / 1 = 1978 (the remainder is 0, so 1 and 1978 are divisors of 1978)
- 1978 / 2 = 989 (the remainder is 0, so 2 and 989 are divisors of 1978)
- 1978 / 3 = 659.33333333333 (the remainder is 1, so 3 is not a divisor of 1978)
- ...
- 1978 / 43 = 46 (the remainder is 0, so 43 and 46 are divisors of 1978)
- 1978 / 44 = 44.954545454545 (the remainder is 42, so 44 is not a divisor of 1978)