What are the divisors of 122?

1, 2, 61, 122

2 even divisors

2, 122

2 odd divisors

1, 61

How to compute the divisors of 122?

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

  • 122 / 1 = 122 (the remainder is 0, so 1 is a divisor of 122)
  • 122 / 2 = 61 (the remainder is 0, so 2 is a divisor of 122)
  • 122 / 3 = 40.666666666667 (the remainder is 2, so 3 is not a divisor of 122)
  • ...
  • 122 / 121 = 1.0082644628099 (the remainder is 1, so 121 is not a divisor of 122)
  • 122 / 122 = 1 (the remainder is 0, so 122 is a divisor of 122)

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 122 (i.e. 11.045361017187). 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 )

  • 122 / 1 = 122 (the remainder is 0, so 1 and 122 are divisors of 122)
  • 122 / 2 = 61 (the remainder is 0, so 2 and 61 are divisors of 122)
  • 122 / 3 = 40.666666666667 (the remainder is 2, so 3 is not a divisor of 122)
  • ...
  • 122 / 10 = 12.2 (the remainder is 2, so 10 is not a divisor of 122)
  • 122 / 11 = 11.090909090909 (the remainder is 1, so 11 is not a divisor of 122)