What are the divisors of 777?
1, 3, 7, 21, 37, 111, 259, 777
- There is a total of 8 positive divisors.
- The sum of these divisors is 1216.
- The arithmetic mean is 152.
8 odd divisors
1, 3, 7, 21, 37, 111, 259, 777
How to compute the divisors of 777?
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.
Brute force algorithm
We could start by using a brute-force method which would involve dividing 777 by each of the numbers from 1 to 777 to determine which ones have a remainder equal to 0.
(where is the integer part of the quotient)
- 777 / 1 = 777 (the remainder is 0, so 1 is a divisor of 777)
- 777 / 2 = 388.5 (the remainder is 1, so 2 is not a divisor of 777)
- 777 / 3 = 259 (the remainder is 0, so 3 is a divisor of 777)
- ...
- 777 / 776 = 1.0012886597938 (the remainder is 1, so 776 is not a divisor of 777)
- 777 / 777 = 1 (the remainder is 0, so 777 is a divisor of 777)
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 777 (i.e. 27.874719729533). Indeed, if a number N has a divisor D greater than its square root, then there is necessarily a smaller divisor d such that:
(thus, if , then )
- 777 / 1 = 777 (the remainder is 0, so 1 and 777 are divisors of 777)
- 777 / 2 = 388.5 (the remainder is 1, so 2 is not a divisor of 777)
- 777 / 3 = 259 (the remainder is 0, so 3 and 259 are divisors of 777)
- ...
- 777 / 26 = 29.884615384615 (the remainder is 23, so 26 is not a divisor of 777)
- 777 / 27 = 28.777777777778 (the remainder is 21, so 27 is not a divisor of 777)