What are the divisors of 3996?
1, 2, 3, 4, 6, 9, 12, 18, 27, 36, 37, 54, 74, 108, 111, 148, 222, 333, 444, 666, 999, 1332, 1998, 3996
- There is a total of 24 positive divisors.
- The sum of these divisors is 10640.
- The arithmetic mean is 443.33333333333.
16 even divisors
2, 4, 6, 12, 18, 36, 54, 74, 108, 148, 222, 444, 666, 1332, 1998, 3996
8 odd divisors
1, 3, 9, 27, 37, 111, 333, 999
How to compute the divisors of 3996?
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 3996 by each of the numbers from 1 to 3996 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 3996 / 1 = 3996 (the remainder is 0, so 1 is a divisor of 3996)
- 3996 / 2 = 1998 (the remainder is 0, so 2 is a divisor of 3996)
- 3996 / 3 = 1332 (the remainder is 0, so 3 is a divisor of 3996)
- ...
- 3996 / 3995 = 1.0002503128911 (the remainder is 1, so 3995 is not a divisor of 3996)
- 3996 / 3996 = 1 (the remainder is 0, so 3996 is a divisor of 3996)
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 3996 (i.e. 63.213922517116). 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 )
- 3996 / 1 = 3996 (the remainder is 0, so 1 and 3996 are divisors of 3996)
- 3996 / 2 = 1998 (the remainder is 0, so 2 and 1998 are divisors of 3996)
- 3996 / 3 = 1332 (the remainder is 0, so 3 and 1332 are divisors of 3996)
- ...
- 3996 / 62 = 64.451612903226 (the remainder is 28, so 62 is not a divisor of 3996)
- 3996 / 63 = 63.428571428571 (the remainder is 27, so 63 is not a divisor of 3996)