What are the divisors of 252?
1, 2, 3, 4, 6, 7, 9, 12, 14, 18, 21, 28, 36, 42, 63, 84, 126, 252
- There is a total of 18 positive divisors.
- The sum of these divisors is 728.
- The arithmetic mean is 40.444444444444.
12 even divisors
2, 4, 6, 12, 14, 18, 28, 36, 42, 84, 126, 252
6 odd divisors
1, 3, 7, 9, 21, 63
How to compute the divisors of 252?
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 252 by each of the numbers from 1 to 252 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 252 / 1 = 252 (the remainder is 0, so 1 is a divisor of 252)
- 252 / 2 = 126 (the remainder is 0, so 2 is a divisor of 252)
- 252 / 3 = 84 (the remainder is 0, so 3 is a divisor of 252)
- ...
- 252 / 251 = 1.003984063745 (the remainder is 1, so 251 is not a divisor of 252)
- 252 / 252 = 1 (the remainder is 0, so 252 is a divisor of 252)
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 252 (i.e. 15.874507866388). 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 )
- 252 / 1 = 252 (the remainder is 0, so 1 and 252 are divisors of 252)
- 252 / 2 = 126 (the remainder is 0, so 2 and 126 are divisors of 252)
- 252 / 3 = 84 (the remainder is 0, so 3 and 84 are divisors of 252)
- ...
- 252 / 14 = 18 (the remainder is 0, so 14 and 18 are divisors of 252)
- 252 / 15 = 16.8 (the remainder is 12, so 15 is not a divisor of 252)