What are the divisors of 3942?

1, 2, 3, 6, 9, 18, 27, 54, 73, 146, 219, 438, 657, 1314, 1971, 3942

8 even divisors

2, 6, 18, 54, 146, 438, 1314, 3942

8 odd divisors

1, 3, 9, 27, 73, 219, 657, 1971

How to compute the divisors of 3942?

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

  • 3942 / 1 = 3942 (the remainder is 0, so 1 is a divisor of 3942)
  • 3942 / 2 = 1971 (the remainder is 0, so 2 is a divisor of 3942)
  • 3942 / 3 = 1314 (the remainder is 0, so 3 is a divisor of 3942)
  • ...
  • 3942 / 3941 = 1.0002537427049 (the remainder is 1, so 3941 is not a divisor of 3942)
  • 3942 / 3942 = 1 (the remainder is 0, so 3942 is a divisor of 3942)

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 3942 (i.e. 62.785348609369). 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 )

  • 3942 / 1 = 3942 (the remainder is 0, so 1 and 3942 are divisors of 3942)
  • 3942 / 2 = 1971 (the remainder is 0, so 2 and 1971 are divisors of 3942)
  • 3942 / 3 = 1314 (the remainder is 0, so 3 and 1314 are divisors of 3942)
  • ...
  • 3942 / 61 = 64.622950819672 (the remainder is 38, so 61 is not a divisor of 3942)
  • 3942 / 62 = 63.58064516129 (the remainder is 36, so 62 is not a divisor of 3942)