What are the divisors of 3018?
1, 2, 3, 6, 503, 1006, 1509, 3018
- There is a total of 8 positive divisors.
- The sum of these divisors is 6048.
- The arithmetic mean is 756.
4 even divisors
2, 6, 1006, 3018
4 odd divisors
1, 3, 503, 1509
How to compute the divisors of 3018?
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 3018 by each of the numbers from 1 to 3018 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 3018 / 1 = 3018 (the remainder is 0, so 1 is a divisor of 3018)
- 3018 / 2 = 1509 (the remainder is 0, so 2 is a divisor of 3018)
- 3018 / 3 = 1006 (the remainder is 0, so 3 is a divisor of 3018)
- ...
- 3018 / 3017 = 1.0003314550878 (the remainder is 1, so 3017 is not a divisor of 3018)
- 3018 / 3018 = 1 (the remainder is 0, so 3018 is a divisor of 3018)
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 3018 (i.e. 54.936326779281). 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 )
- 3018 / 1 = 3018 (the remainder is 0, so 1 and 3018 are divisors of 3018)
- 3018 / 2 = 1509 (the remainder is 0, so 2 and 1509 are divisors of 3018)
- 3018 / 3 = 1006 (the remainder is 0, so 3 and 1006 are divisors of 3018)
- ...
- 3018 / 53 = 56.943396226415 (the remainder is 50, so 53 is not a divisor of 3018)
- 3018 / 54 = 55.888888888889 (the remainder is 48, so 54 is not a divisor of 3018)