What are the divisors of 5940?

1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 15, 18, 20, 22, 27, 30, 33, 36, 44, 45, 54, 55, 60, 66, 90, 99, 108, 110, 132, 135, 165, 180, 198, 220, 270, 297, 330, 396, 495, 540, 594, 660, 990, 1188, 1485, 1980, 2970, 5940

32 even divisors

2, 4, 6, 10, 12, 18, 20, 22, 30, 36, 44, 54, 60, 66, 90, 108, 110, 132, 180, 198, 220, 270, 330, 396, 540, 594, 660, 990, 1188, 1980, 2970, 5940

16 odd divisors

1, 3, 5, 9, 11, 15, 27, 33, 45, 55, 99, 135, 165, 297, 495, 1485

How to compute the divisors of 5940?

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

  • 5940 / 1 = 5940 (the remainder is 0, so 1 is a divisor of 5940)
  • 5940 / 2 = 2970 (the remainder is 0, so 2 is a divisor of 5940)
  • 5940 / 3 = 1980 (the remainder is 0, so 3 is a divisor of 5940)
  • ...
  • 5940 / 5939 = 1.0001683785149 (the remainder is 1, so 5939 is not a divisor of 5940)
  • 5940 / 5940 = 1 (the remainder is 0, so 5940 is a divisor of 5940)

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 5940 (i.e. 77.071395471991). 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 )

  • 5940 / 1 = 5940 (the remainder is 0, so 1 and 5940 are divisors of 5940)
  • 5940 / 2 = 2970 (the remainder is 0, so 2 and 2970 are divisors of 5940)
  • 5940 / 3 = 1980 (the remainder is 0, so 3 and 1980 are divisors of 5940)
  • ...
  • 5940 / 76 = 78.157894736842 (the remainder is 12, so 76 is not a divisor of 5940)
  • 5940 / 77 = 77.142857142857 (the remainder is 11, so 77 is not a divisor of 5940)