What are the divisors of 5084?

1, 2, 4, 31, 41, 62, 82, 124, 164, 1271, 2542, 5084

8 even divisors

2, 4, 62, 82, 124, 164, 2542, 5084

4 odd divisors

1, 31, 41, 1271

How to compute the divisors of 5084?

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

  • 5084 / 1 = 5084 (the remainder is 0, so 1 is a divisor of 5084)
  • 5084 / 2 = 2542 (the remainder is 0, so 2 is a divisor of 5084)
  • 5084 / 3 = 1694.6666666667 (the remainder is 2, so 3 is not a divisor of 5084)
  • ...
  • 5084 / 5083 = 1.0001967342121 (the remainder is 1, so 5083 is not a divisor of 5084)
  • 5084 / 5084 = 1 (the remainder is 0, so 5084 is a divisor of 5084)

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 5084 (i.e. 71.302173879904). 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 )

  • 5084 / 1 = 5084 (the remainder is 0, so 1 and 5084 are divisors of 5084)
  • 5084 / 2 = 2542 (the remainder is 0, so 2 and 2542 are divisors of 5084)
  • 5084 / 3 = 1694.6666666667 (the remainder is 2, so 3 is not a divisor of 5084)
  • ...
  • 5084 / 70 = 72.628571428571 (the remainder is 44, so 70 is not a divisor of 5084)
  • 5084 / 71 = 71.605633802817 (the remainder is 43, so 71 is not a divisor of 5084)