What are the divisors of 1638?

1, 2, 3, 6, 7, 9, 13, 14, 18, 21, 26, 39, 42, 63, 78, 91, 117, 126, 182, 234, 273, 546, 819, 1638

12 even divisors

2, 6, 14, 18, 26, 42, 78, 126, 182, 234, 546, 1638

12 odd divisors

1, 3, 7, 9, 13, 21, 39, 63, 91, 117, 273, 819

How to compute the divisors of 1638?

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

  • 1638 / 1 = 1638 (the remainder is 0, so 1 is a divisor of 1638)
  • 1638 / 2 = 819 (the remainder is 0, so 2 is a divisor of 1638)
  • 1638 / 3 = 546 (the remainder is 0, so 3 is a divisor of 1638)
  • ...
  • 1638 / 1637 = 1.0006108735492 (the remainder is 1, so 1637 is not a divisor of 1638)
  • 1638 / 1638 = 1 (the remainder is 0, so 1638 is a divisor of 1638)

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 1638 (i.e. 40.472212689696). 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 )

  • 1638 / 1 = 1638 (the remainder is 0, so 1 and 1638 are divisors of 1638)
  • 1638 / 2 = 819 (the remainder is 0, so 2 and 819 are divisors of 1638)
  • 1638 / 3 = 546 (the remainder is 0, so 3 and 546 are divisors of 1638)
  • ...
  • 1638 / 39 = 42 (the remainder is 0, so 39 and 42 are divisors of 1638)
  • 1638 / 40 = 40.95 (the remainder is 38, so 40 is not a divisor of 1638)