What are the divisors of 3222?

1, 2, 3, 6, 9, 18, 179, 358, 537, 1074, 1611, 3222

6 even divisors

2, 6, 18, 358, 1074, 3222

6 odd divisors

1, 3, 9, 179, 537, 1611

How to compute the divisors of 3222?

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

  • 3222 / 1 = 3222 (the remainder is 0, so 1 is a divisor of 3222)
  • 3222 / 2 = 1611 (the remainder is 0, so 2 is a divisor of 3222)
  • 3222 / 3 = 1074 (the remainder is 0, so 3 is a divisor of 3222)
  • ...
  • 3222 / 3221 = 1.0003104625893 (the remainder is 1, so 3221 is not a divisor of 3222)
  • 3222 / 3222 = 1 (the remainder is 0, so 3222 is a divisor of 3222)

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 3222 (i.e. 56.762663785274). 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 )

  • 3222 / 1 = 3222 (the remainder is 0, so 1 and 3222 are divisors of 3222)
  • 3222 / 2 = 1611 (the remainder is 0, so 2 and 1611 are divisors of 3222)
  • 3222 / 3 = 1074 (the remainder is 0, so 3 and 1074 are divisors of 3222)
  • ...
  • 3222 / 55 = 58.581818181818 (the remainder is 32, so 55 is not a divisor of 3222)
  • 3222 / 56 = 57.535714285714 (the remainder is 30, so 56 is not a divisor of 3222)