What are the divisors of 8040?

1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, 67, 120, 134, 201, 268, 335, 402, 536, 670, 804, 1005, 1340, 1608, 2010, 2680, 4020, 8040

24 even divisors

2, 4, 6, 8, 10, 12, 20, 24, 30, 40, 60, 120, 134, 268, 402, 536, 670, 804, 1340, 1608, 2010, 2680, 4020, 8040

8 odd divisors

1, 3, 5, 15, 67, 201, 335, 1005

How to compute the divisors of 8040?

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

  • 8040 / 1 = 8040 (the remainder is 0, so 1 is a divisor of 8040)
  • 8040 / 2 = 4020 (the remainder is 0, so 2 is a divisor of 8040)
  • 8040 / 3 = 2680 (the remainder is 0, so 3 is a divisor of 8040)
  • ...
  • 8040 / 8039 = 1.0001243935813 (the remainder is 1, so 8039 is not a divisor of 8040)
  • 8040 / 8040 = 1 (the remainder is 0, so 8040 is a divisor of 8040)

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 8040 (i.e. 89.66604708584). 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 )

  • 8040 / 1 = 8040 (the remainder is 0, so 1 and 8040 are divisors of 8040)
  • 8040 / 2 = 4020 (the remainder is 0, so 2 and 4020 are divisors of 8040)
  • 8040 / 3 = 2680 (the remainder is 0, so 3 and 2680 are divisors of 8040)
  • ...
  • 8040 / 88 = 91.363636363636 (the remainder is 32, so 88 is not a divisor of 8040)
  • 8040 / 89 = 90.337078651685 (the remainder is 30, so 89 is not a divisor of 8040)