What are the divisors of 2022?
1, 2, 3, 6, 337, 674, 1011, 2022
- There is a total of 8 positive divisors.
- The sum of these divisors is 4056.
- The arithmetic mean is 507.
4 even divisors
2, 6, 674, 2022
4 odd divisors
1, 3, 337, 1011
How to compute the divisors of 2022?
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 2022 by each of the numbers from 1 to 2022 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 2022 / 1 = 2022 (the remainder is 0, so 1 is a divisor of 2022)
- 2022 / 2 = 1011 (the remainder is 0, so 2 is a divisor of 2022)
- 2022 / 3 = 674 (the remainder is 0, so 3 is a divisor of 2022)
- ...
- 2022 / 2021 = 1.0004948045522 (the remainder is 1, so 2021 is not a divisor of 2022)
- 2022 / 2022 = 1 (the remainder is 0, so 2022 is a divisor of 2022)
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 2022 (i.e. 44.966654311834). 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 )
- 2022 / 1 = 2022 (the remainder is 0, so 1 and 2022 are divisors of 2022)
- 2022 / 2 = 1011 (the remainder is 0, so 2 and 1011 are divisors of 2022)
- 2022 / 3 = 674 (the remainder is 0, so 3 and 674 are divisors of 2022)
- ...
- 2022 / 43 = 47.023255813953 (the remainder is 1, so 43 is not a divisor of 2022)
- 2022 / 44 = 45.954545454545 (the remainder is 42, so 44 is not a divisor of 2022)