What are the divisors of 3542?

1, 2, 7, 11, 14, 22, 23, 46, 77, 154, 161, 253, 322, 506, 1771, 3542

8 even divisors

2, 14, 22, 46, 154, 322, 506, 3542

8 odd divisors

1, 7, 11, 23, 77, 161, 253, 1771

How to compute the divisors of 3542?

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

  • 3542 / 1 = 3542 (the remainder is 0, so 1 is a divisor of 3542)
  • 3542 / 2 = 1771 (the remainder is 0, so 2 is a divisor of 3542)
  • 3542 / 3 = 1180.6666666667 (the remainder is 2, so 3 is not a divisor of 3542)
  • ...
  • 3542 / 3541 = 1.0002824061 (the remainder is 1, so 3541 is not a divisor of 3542)
  • 3542 / 3542 = 1 (the remainder is 0, so 3542 is a divisor of 3542)

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 3542 (i.e. 59.514704065466). 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 )

  • 3542 / 1 = 3542 (the remainder is 0, so 1 and 3542 are divisors of 3542)
  • 3542 / 2 = 1771 (the remainder is 0, so 2 and 1771 are divisors of 3542)
  • 3542 / 3 = 1180.6666666667 (the remainder is 2, so 3 is not a divisor of 3542)
  • ...
  • 3542 / 58 = 61.068965517241 (the remainder is 4, so 58 is not a divisor of 3542)
  • 3542 / 59 = 60.033898305085 (the remainder is 2, so 59 is not a divisor of 3542)