What are the divisors of 5640?

1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 47, 60, 94, 120, 141, 188, 235, 282, 376, 470, 564, 705, 940, 1128, 1410, 1880, 2820, 5640

24 even divisors

2, 4, 6, 8, 10, 12, 20, 24, 30, 40, 60, 94, 120, 188, 282, 376, 470, 564, 940, 1128, 1410, 1880, 2820, 5640

8 odd divisors

1, 3, 5, 15, 47, 141, 235, 705

How to compute the divisors of 5640?

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

  • 5640 / 1 = 5640 (the remainder is 0, so 1 is a divisor of 5640)
  • 5640 / 2 = 2820 (the remainder is 0, so 2 is a divisor of 5640)
  • 5640 / 3 = 1880 (the remainder is 0, so 3 is a divisor of 5640)
  • ...
  • 5640 / 5639 = 1.0001773364072 (the remainder is 1, so 5639 is not a divisor of 5640)
  • 5640 / 5640 = 1 (the remainder is 0, so 5640 is a divisor of 5640)

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 5640 (i.e. 75.099933422074). 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 )

  • 5640 / 1 = 5640 (the remainder is 0, so 1 and 5640 are divisors of 5640)
  • 5640 / 2 = 2820 (the remainder is 0, so 2 and 2820 are divisors of 5640)
  • 5640 / 3 = 1880 (the remainder is 0, so 3 and 1880 are divisors of 5640)
  • ...
  • 5640 / 74 = 76.216216216216 (the remainder is 16, so 74 is not a divisor of 5640)
  • 5640 / 75 = 75.2 (the remainder is 15, so 75 is not a divisor of 5640)