What are the divisors of 3178?

1, 2, 7, 14, 227, 454, 1589, 3178

4 even divisors

2, 14, 454, 3178

4 odd divisors

1, 7, 227, 1589

How to compute the divisors of 3178?

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

  • 3178 / 1 = 3178 (the remainder is 0, so 1 is a divisor of 3178)
  • 3178 / 2 = 1589 (the remainder is 0, so 2 is a divisor of 3178)
  • 3178 / 3 = 1059.3333333333 (the remainder is 1, so 3 is not a divisor of 3178)
  • ...
  • 3178 / 3177 = 1.0003147623544 (the remainder is 1, so 3177 is not a divisor of 3178)
  • 3178 / 3178 = 1 (the remainder is 0, so 3178 is a divisor of 3178)

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 3178 (i.e. 56.373752757822). 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 )

  • 3178 / 1 = 3178 (the remainder is 0, so 1 and 3178 are divisors of 3178)
  • 3178 / 2 = 1589 (the remainder is 0, so 2 and 1589 are divisors of 3178)
  • 3178 / 3 = 1059.3333333333 (the remainder is 1, so 3 is not a divisor of 3178)
  • ...
  • 3178 / 55 = 57.781818181818 (the remainder is 43, so 55 is not a divisor of 3178)
  • 3178 / 56 = 56.75 (the remainder is 42, so 56 is not a divisor of 3178)