What are the divisors of 7018?

1, 2, 11, 22, 29, 58, 121, 242, 319, 638, 3509, 7018

6 even divisors

2, 22, 58, 242, 638, 7018

6 odd divisors

1, 11, 29, 121, 319, 3509

How to compute the divisors of 7018?

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

  • 7018 / 1 = 7018 (the remainder is 0, so 1 is a divisor of 7018)
  • 7018 / 2 = 3509 (the remainder is 0, so 2 is a divisor of 7018)
  • 7018 / 3 = 2339.3333333333 (the remainder is 1, so 3 is not a divisor of 7018)
  • ...
  • 7018 / 7017 = 1.0001425110446 (the remainder is 1, so 7017 is not a divisor of 7018)
  • 7018 / 7018 = 1 (the remainder is 0, so 7018 is a divisor of 7018)

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 7018 (i.e. 83.773504164503). 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 )

  • 7018 / 1 = 7018 (the remainder is 0, so 1 and 7018 are divisors of 7018)
  • 7018 / 2 = 3509 (the remainder is 0, so 2 and 3509 are divisors of 7018)
  • 7018 / 3 = 2339.3333333333 (the remainder is 1, so 3 is not a divisor of 7018)
  • ...
  • 7018 / 82 = 85.585365853659 (the remainder is 48, so 82 is not a divisor of 7018)
  • 7018 / 83 = 84.55421686747 (the remainder is 46, so 83 is not a divisor of 7018)