What are the divisors of 5838?

1, 2, 3, 6, 7, 14, 21, 42, 139, 278, 417, 834, 973, 1946, 2919, 5838

8 even divisors

2, 6, 14, 42, 278, 834, 1946, 5838

8 odd divisors

1, 3, 7, 21, 139, 417, 973, 2919

How to compute the divisors of 5838?

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.

N mod M = 0

Brute force algorithm

We could start by using a brute-force method which would involve dividing 5838 by each of the numbers from 1 to 5838 to determine which ones have a remainder equal to 0.

Remainder = N ( M × N M )

(where N M is the integer part of the quotient)

  • 5838 / 1 = 5838 (the remainder is 0, so 1 is a divisor of 5838)
  • 5838 / 2 = 2919 (the remainder is 0, so 2 is a divisor of 5838)
  • 5838 / 3 = 1946 (the remainder is 0, so 3 is a divisor of 5838)
  • ...
  • 5838 / 5837 = 1.000171320884 (the remainder is 1, so 5837 is not a divisor of 5838)
  • 5838 / 5838 = 1 (the remainder is 0, so 5838 is a divisor of 5838)

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 5838 (i.e. 76.406805979572). Indeed, if a number N has a divisor D greater than its square root, then there is necessarily a smaller divisor d such that:

D × d = N

(thus, if N D = d , then N d = D )

  • 5838 / 1 = 5838 (the remainder is 0, so 1 and 5838 are divisors of 5838)
  • 5838 / 2 = 2919 (the remainder is 0, so 2 and 2919 are divisors of 5838)
  • 5838 / 3 = 1946 (the remainder is 0, so 3 and 1946 are divisors of 5838)
  • ...
  • 5838 / 75 = 77.84 (the remainder is 63, so 75 is not a divisor of 5838)
  • 5838 / 76 = 76.815789473684 (the remainder is 62, so 76 is not a divisor of 5838)