What are the divisors of 330?

1, 2, 3, 5, 6, 10, 11, 15, 22, 30, 33, 55, 66, 110, 165, 330

8 even divisors

2, 6, 10, 22, 30, 66, 110, 330

8 odd divisors

1, 3, 5, 11, 15, 33, 55, 165

How to compute the divisors of 330?

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

  • 330 / 1 = 330 (the remainder is 0, so 1 is a divisor of 330)
  • 330 / 2 = 165 (the remainder is 0, so 2 is a divisor of 330)
  • 330 / 3 = 110 (the remainder is 0, so 3 is a divisor of 330)
  • ...
  • 330 / 329 = 1.0030395136778 (the remainder is 1, so 329 is not a divisor of 330)
  • 330 / 330 = 1 (the remainder is 0, so 330 is a divisor of 330)

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 330 (i.e. 18.165902124585). 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 )

  • 330 / 1 = 330 (the remainder is 0, so 1 and 330 are divisors of 330)
  • 330 / 2 = 165 (the remainder is 0, so 2 and 165 are divisors of 330)
  • 330 / 3 = 110 (the remainder is 0, so 3 and 110 are divisors of 330)
  • ...
  • 330 / 17 = 19.411764705882 (the remainder is 7, so 17 is not a divisor of 330)
  • 330 / 18 = 18.333333333333 (the remainder is 6, so 18 is not a divisor of 330)