What are the divisors of 1794?

1, 2, 3, 6, 13, 23, 26, 39, 46, 69, 78, 138, 299, 598, 897, 1794

8 even divisors

2, 6, 26, 46, 78, 138, 598, 1794

8 odd divisors

1, 3, 13, 23, 39, 69, 299, 897

How to compute the divisors of 1794?

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

  • 1794 / 1 = 1794 (the remainder is 0, so 1 is a divisor of 1794)
  • 1794 / 2 = 897 (the remainder is 0, so 2 is a divisor of 1794)
  • 1794 / 3 = 598 (the remainder is 0, so 3 is a divisor of 1794)
  • ...
  • 1794 / 1793 = 1.0005577244841 (the remainder is 1, so 1793 is not a divisor of 1794)
  • 1794 / 1794 = 1 (the remainder is 0, so 1794 is a divisor of 1794)

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 1794 (i.e. 42.355637169095). 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 )

  • 1794 / 1 = 1794 (the remainder is 0, so 1 and 1794 are divisors of 1794)
  • 1794 / 2 = 897 (the remainder is 0, so 2 and 897 are divisors of 1794)
  • 1794 / 3 = 598 (the remainder is 0, so 3 and 598 are divisors of 1794)
  • ...
  • 1794 / 41 = 43.756097560976 (the remainder is 31, so 41 is not a divisor of 1794)
  • 1794 / 42 = 42.714285714286 (the remainder is 30, so 42 is not a divisor of 1794)