What are the divisors of 790?

1, 2, 5, 10, 79, 158, 395, 790

4 even divisors

2, 10, 158, 790

4 odd divisors

1, 5, 79, 395

How to compute the divisors of 790?

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

  • 790 / 1 = 790 (the remainder is 0, so 1 is a divisor of 790)
  • 790 / 2 = 395 (the remainder is 0, so 2 is a divisor of 790)
  • 790 / 3 = 263.33333333333 (the remainder is 1, so 3 is not a divisor of 790)
  • ...
  • 790 / 789 = 1.0012674271229 (the remainder is 1, so 789 is not a divisor of 790)
  • 790 / 790 = 1 (the remainder is 0, so 790 is a divisor of 790)

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 790 (i.e. 28.10693864511). 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 )

  • 790 / 1 = 790 (the remainder is 0, so 1 and 790 are divisors of 790)
  • 790 / 2 = 395 (the remainder is 0, so 2 and 395 are divisors of 790)
  • 790 / 3 = 263.33333333333 (the remainder is 1, so 3 is not a divisor of 790)
  • ...
  • 790 / 27 = 29.259259259259 (the remainder is 7, so 27 is not a divisor of 790)
  • 790 / 28 = 28.214285714286 (the remainder is 6, so 28 is not a divisor of 790)