Problem Statement | |||||||||||||
An integer x is called a proper divisor of an integer y if x is a divisor of y and 1 <= x < y. Let us denote as s(a) the sum of all proper divisors of a. An integer a is called almost perfect by k if |a-s(a)| <= k. You are given ints left, right and k. Return the number of integers between left and right, inclusive, that are almost perfect by k. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | left will be between 2 and 1000, inclusive. | ||||||||||||
- | right will be between left and 1000, inclusive. | ||||||||||||
- | k will be between 0 and 1000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|