What are the divisors of 6138?

1, 2, 3, 6, 9, 11, 18, 22, 31, 33, 62, 66, 93, 99, 186, 198, 279, 341, 558, 682, 1023, 2046, 3069, 6138

12 even divisors

2, 6, 18, 22, 62, 66, 186, 198, 558, 682, 2046, 6138

12 odd divisors

1, 3, 9, 11, 31, 33, 93, 99, 279, 341, 1023, 3069

How to compute the divisors of 6138?

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 6138 by each of the numbers from 1 to 6138 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)

  • 6138 / 1 = 6138 (the remainder is 0, so 1 is a divisor of 6138)
  • 6138 / 2 = 3069 (the remainder is 0, so 2 is a divisor of 6138)
  • 6138 / 3 = 2046 (the remainder is 0, so 3 is a divisor of 6138)
  • ...
  • 6138 / 6137 = 1.0001629460649 (the remainder is 1, so 6137 is not a divisor of 6138)
  • 6138 / 6138 = 1 (the remainder is 0, so 6138 is a divisor of 6138)

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 6138 (i.e. 78.345389143204). 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 )

  • 6138 / 1 = 6138 (the remainder is 0, so 1 and 6138 are divisors of 6138)
  • 6138 / 2 = 3069 (the remainder is 0, so 2 and 3069 are divisors of 6138)
  • 6138 / 3 = 2046 (the remainder is 0, so 3 and 2046 are divisors of 6138)
  • ...
  • 6138 / 77 = 79.714285714286 (the remainder is 55, so 77 is not a divisor of 6138)
  • 6138 / 78 = 78.692307692308 (the remainder is 54, so 78 is not a divisor of 6138)