What are the divisors of 8004?

1, 2, 3, 4, 6, 12, 23, 29, 46, 58, 69, 87, 92, 116, 138, 174, 276, 348, 667, 1334, 2001, 2668, 4002, 8004

16 even divisors

2, 4, 6, 12, 46, 58, 92, 116, 138, 174, 276, 348, 1334, 2668, 4002, 8004

8 odd divisors

1, 3, 23, 29, 69, 87, 667, 2001

How to compute the divisors of 8004?

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

  • 8004 / 1 = 8004 (the remainder is 0, so 1 is a divisor of 8004)
  • 8004 / 2 = 4002 (the remainder is 0, so 2 is a divisor of 8004)
  • 8004 / 3 = 2668 (the remainder is 0, so 3 is a divisor of 8004)
  • ...
  • 8004 / 8003 = 1.0001249531426 (the remainder is 1, so 8003 is not a divisor of 8004)
  • 8004 / 8004 = 1 (the remainder is 0, so 8004 is a divisor of 8004)

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 8004 (i.e. 89.46507698538). 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 )

  • 8004 / 1 = 8004 (the remainder is 0, so 1 and 8004 are divisors of 8004)
  • 8004 / 2 = 4002 (the remainder is 0, so 2 and 4002 are divisors of 8004)
  • 8004 / 3 = 2668 (the remainder is 0, so 3 and 2668 are divisors of 8004)
  • ...
  • 8004 / 88 = 90.954545454545 (the remainder is 84, so 88 is not a divisor of 8004)
  • 8004 / 89 = 89.932584269663 (the remainder is 83, so 89 is not a divisor of 8004)