What are the divisors of 5010?

1, 2, 3, 5, 6, 10, 15, 30, 167, 334, 501, 835, 1002, 1670, 2505, 5010

8 even divisors

2, 6, 10, 30, 334, 1002, 1670, 5010

8 odd divisors

1, 3, 5, 15, 167, 501, 835, 2505

How to compute the divisors of 5010?

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

  • 5010 / 1 = 5010 (the remainder is 0, so 1 is a divisor of 5010)
  • 5010 / 2 = 2505 (the remainder is 0, so 2 is a divisor of 5010)
  • 5010 / 3 = 1670 (the remainder is 0, so 3 is a divisor of 5010)
  • ...
  • 5010 / 5009 = 1.0001996406468 (the remainder is 1, so 5009 is not a divisor of 5010)
  • 5010 / 5010 = 1 (the remainder is 0, so 5010 is a divisor of 5010)

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 5010 (i.e. 70.781353476746). 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 )

  • 5010 / 1 = 5010 (the remainder is 0, so 1 and 5010 are divisors of 5010)
  • 5010 / 2 = 2505 (the remainder is 0, so 2 and 2505 are divisors of 5010)
  • 5010 / 3 = 1670 (the remainder is 0, so 3 and 1670 are divisors of 5010)
  • ...
  • 5010 / 69 = 72.608695652174 (the remainder is 42, so 69 is not a divisor of 5010)
  • 5010 / 70 = 71.571428571429 (the remainder is 40, so 70 is not a divisor of 5010)