What are the divisors of 5180?

1, 2, 4, 5, 7, 10, 14, 20, 28, 35, 37, 70, 74, 140, 148, 185, 259, 370, 518, 740, 1036, 1295, 2590, 5180

16 even divisors

2, 4, 10, 14, 20, 28, 70, 74, 140, 148, 370, 518, 740, 1036, 2590, 5180

8 odd divisors

1, 5, 7, 35, 37, 185, 259, 1295

How to compute the divisors of 5180?

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

  • 5180 / 1 = 5180 (the remainder is 0, so 1 is a divisor of 5180)
  • 5180 / 2 = 2590 (the remainder is 0, so 2 is a divisor of 5180)
  • 5180 / 3 = 1726.6666666667 (the remainder is 2, so 3 is not a divisor of 5180)
  • ...
  • 5180 / 5179 = 1.0001930874686 (the remainder is 1, so 5179 is not a divisor of 5180)
  • 5180 / 5180 = 1 (the remainder is 0, so 5180 is a divisor of 5180)

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 5180 (i.e. 71.972216861786). 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 )

  • 5180 / 1 = 5180 (the remainder is 0, so 1 and 5180 are divisors of 5180)
  • 5180 / 2 = 2590 (the remainder is 0, so 2 and 2590 are divisors of 5180)
  • 5180 / 3 = 1726.6666666667 (the remainder is 2, so 3 is not a divisor of 5180)
  • ...
  • 5180 / 70 = 74 (the remainder is 0, so 70 and 74 are divisors of 5180)
  • 5180 / 71 = 72.957746478873 (the remainder is 68, so 71 is not a divisor of 5180)