What are the divisors of 7042?
1, 2, 7, 14, 503, 1006, 3521, 7042
- There is a total of 8 positive divisors.
- The sum of these divisors is 12096.
- The arithmetic mean is 1512.
4 even divisors
2, 14, 1006, 7042
4 odd divisors
1, 7, 503, 3521
How to compute the divisors of 7042?
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 7042 by each of the numbers from 1 to 7042 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 7042 / 1 = 7042 (the remainder is 0, so 1 is a divisor of 7042)
- 7042 / 2 = 3521 (the remainder is 0, so 2 is a divisor of 7042)
- 7042 / 3 = 2347.3333333333 (the remainder is 1, so 3 is not a divisor of 7042)
- ...
- 7042 / 7041 = 1.0001420252805 (the remainder is 1, so 7041 is not a divisor of 7042)
- 7042 / 7042 = 1 (the remainder is 0, so 7042 is a divisor of 7042)
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 7042 (i.e. 83.916625289629). 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 )
- 7042 / 1 = 7042 (the remainder is 0, so 1 and 7042 are divisors of 7042)
- 7042 / 2 = 3521 (the remainder is 0, so 2 and 3521 are divisors of 7042)
- 7042 / 3 = 2347.3333333333 (the remainder is 1, so 3 is not a divisor of 7042)
- ...
- 7042 / 82 = 85.878048780488 (the remainder is 72, so 82 is not a divisor of 7042)
- 7042 / 83 = 84.843373493976 (the remainder is 70, so 83 is not a divisor of 7042)