What are the divisors of 5842?
1, 2, 23, 46, 127, 254, 2921, 5842
- There is a total of 8 positive divisors.
- The sum of these divisors is 9216.
- The arithmetic mean is 1152.
4 even divisors
2, 46, 254, 5842
4 odd divisors
1, 23, 127, 2921
How to compute the divisors of 5842?
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 5842 by each of the numbers from 1 to 5842 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 5842 / 1 = 5842 (the remainder is 0, so 1 is a divisor of 5842)
- 5842 / 2 = 2921 (the remainder is 0, so 2 is a divisor of 5842)
- 5842 / 3 = 1947.3333333333 (the remainder is 1, so 3 is not a divisor of 5842)
- ...
- 5842 / 5841 = 1.000171203561 (the remainder is 1, so 5841 is not a divisor of 5842)
- 5842 / 5842 = 1 (the remainder is 0, so 5842 is a divisor of 5842)
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 5842 (i.e. 76.432977176085). 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 )
- 5842 / 1 = 5842 (the remainder is 0, so 1 and 5842 are divisors of 5842)
- 5842 / 2 = 2921 (the remainder is 0, so 2 and 2921 are divisors of 5842)
- 5842 / 3 = 1947.3333333333 (the remainder is 1, so 3 is not a divisor of 5842)
- ...
- 5842 / 75 = 77.893333333333 (the remainder is 67, so 75 is not a divisor of 5842)
- 5842 / 76 = 76.868421052632 (the remainder is 66, so 76 is not a divisor of 5842)