What are the divisors of 8178?

1, 2, 3, 6, 29, 47, 58, 87, 94, 141, 174, 282, 1363, 2726, 4089, 8178

8 even divisors

2, 6, 58, 94, 174, 282, 2726, 8178

8 odd divisors

1, 3, 29, 47, 87, 141, 1363, 4089

How to compute the divisors of 8178?

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

  • 8178 / 1 = 8178 (the remainder is 0, so 1 is a divisor of 8178)
  • 8178 / 2 = 4089 (the remainder is 0, so 2 is a divisor of 8178)
  • 8178 / 3 = 2726 (the remainder is 0, so 3 is a divisor of 8178)
  • ...
  • 8178 / 8177 = 1.0001222942399 (the remainder is 1, so 8177 is not a divisor of 8178)
  • 8178 / 8178 = 1 (the remainder is 0, so 8178 is a divisor of 8178)

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 8178 (i.e. 90.432295116291). 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 )

  • 8178 / 1 = 8178 (the remainder is 0, so 1 and 8178 are divisors of 8178)
  • 8178 / 2 = 4089 (the remainder is 0, so 2 and 4089 are divisors of 8178)
  • 8178 / 3 = 2726 (the remainder is 0, so 3 and 2726 are divisors of 8178)
  • ...
  • 8178 / 89 = 91.887640449438 (the remainder is 79, so 89 is not a divisor of 8178)
  • 8178 / 90 = 90.866666666667 (the remainder is 78, so 90 is not a divisor of 8178)