What are the divisors of 3798?

1, 2, 3, 6, 9, 18, 211, 422, 633, 1266, 1899, 3798

6 even divisors

2, 6, 18, 422, 1266, 3798

6 odd divisors

1, 3, 9, 211, 633, 1899

How to compute the divisors of 3798?

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

  • 3798 / 1 = 3798 (the remainder is 0, so 1 is a divisor of 3798)
  • 3798 / 2 = 1899 (the remainder is 0, so 2 is a divisor of 3798)
  • 3798 / 3 = 1266 (the remainder is 0, so 3 is a divisor of 3798)
  • ...
  • 3798 / 3797 = 1.0002633658151 (the remainder is 1, so 3797 is not a divisor of 3798)
  • 3798 / 3798 = 1 (the remainder is 0, so 3798 is a divisor of 3798)

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 3798 (i.e. 61.627915752522). 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 )

  • 3798 / 1 = 3798 (the remainder is 0, so 1 and 3798 are divisors of 3798)
  • 3798 / 2 = 1899 (the remainder is 0, so 2 and 1899 are divisors of 3798)
  • 3798 / 3 = 1266 (the remainder is 0, so 3 and 1266 are divisors of 3798)
  • ...
  • 3798 / 60 = 63.3 (the remainder is 18, so 60 is not a divisor of 3798)
  • 3798 / 61 = 62.262295081967 (the remainder is 16, so 61 is not a divisor of 3798)