What are the divisors of 8118?

1, 2, 3, 6, 9, 11, 18, 22, 33, 41, 66, 82, 99, 123, 198, 246, 369, 451, 738, 902, 1353, 2706, 4059, 8118

12 even divisors

2, 6, 18, 22, 66, 82, 198, 246, 738, 902, 2706, 8118

12 odd divisors

1, 3, 9, 11, 33, 41, 99, 123, 369, 451, 1353, 4059

How to compute the divisors of 8118?

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

  • 8118 / 1 = 8118 (the remainder is 0, so 1 is a divisor of 8118)
  • 8118 / 2 = 4059 (the remainder is 0, so 2 is a divisor of 8118)
  • 8118 / 3 = 2706 (the remainder is 0, so 3 is a divisor of 8118)
  • ...
  • 8118 / 8117 = 1.0001231982259 (the remainder is 1, so 8117 is not a divisor of 8118)
  • 8118 / 8118 = 1 (the remainder is 0, so 8118 is a divisor of 8118)

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 8118 (i.e. 90.099944506087). 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 )

  • 8118 / 1 = 8118 (the remainder is 0, so 1 and 8118 are divisors of 8118)
  • 8118 / 2 = 4059 (the remainder is 0, so 2 and 4059 are divisors of 8118)
  • 8118 / 3 = 2706 (the remainder is 0, so 3 and 2706 are divisors of 8118)
  • ...
  • 8118 / 89 = 91.213483146067 (the remainder is 19, so 89 is not a divisor of 8118)
  • 8118 / 90 = 90.2 (the remainder is 18, so 90 is not a divisor of 8118)