What are the divisors of 1966?

1, 2, 983, 1966

2 even divisors

2, 1966

2 odd divisors

1, 983

How to compute the divisors of 1966?

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

  • 1966 / 1 = 1966 (the remainder is 0, so 1 is a divisor of 1966)
  • 1966 / 2 = 983 (the remainder is 0, so 2 is a divisor of 1966)
  • 1966 / 3 = 655.33333333333 (the remainder is 1, so 3 is not a divisor of 1966)
  • ...
  • 1966 / 1965 = 1.0005089058524 (the remainder is 1, so 1965 is not a divisor of 1966)
  • 1966 / 1966 = 1 (the remainder is 0, so 1966 is a divisor of 1966)

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 1966 (i.e. 44.339598554791). 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 )

  • 1966 / 1 = 1966 (the remainder is 0, so 1 and 1966 are divisors of 1966)
  • 1966 / 2 = 983 (the remainder is 0, so 2 and 983 are divisors of 1966)
  • 1966 / 3 = 655.33333333333 (the remainder is 1, so 3 is not a divisor of 1966)
  • ...
  • 1966 / 43 = 45.720930232558 (the remainder is 31, so 43 is not a divisor of 1966)
  • 1966 / 44 = 44.681818181818 (the remainder is 30, so 44 is not a divisor of 1966)