What are the divisors of 2006?

1, 2, 17, 34, 59, 118, 1003, 2006

4 even divisors

2, 34, 118, 2006

4 odd divisors

1, 17, 59, 1003

How to compute the divisors of 2006?

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

  • 2006 / 1 = 2006 (the remainder is 0, so 1 is a divisor of 2006)
  • 2006 / 2 = 1003 (the remainder is 0, so 2 is a divisor of 2006)
  • 2006 / 3 = 668.66666666667 (the remainder is 2, so 3 is not a divisor of 2006)
  • ...
  • 2006 / 2005 = 1.0004987531172 (the remainder is 1, so 2005 is not a divisor of 2006)
  • 2006 / 2006 = 1 (the remainder is 0, so 2006 is a divisor of 2006)

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 2006 (i.e. 44.788391353117). 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 )

  • 2006 / 1 = 2006 (the remainder is 0, so 1 and 2006 are divisors of 2006)
  • 2006 / 2 = 1003 (the remainder is 0, so 2 and 1003 are divisors of 2006)
  • 2006 / 3 = 668.66666666667 (the remainder is 2, so 3 is not a divisor of 2006)
  • ...
  • 2006 / 43 = 46.651162790698 (the remainder is 28, so 43 is not a divisor of 2006)
  • 2006 / 44 = 45.590909090909 (the remainder is 26, so 44 is not a divisor of 2006)