Problem Statement |
| | An integer k greater than 0 is called a cool divisor of m if it is less than m and divides m, but k^n does not divide m. Let d(m) denote the number of cool divisors that exist for an integer m. Given two integers a and b return the sum d(a) + d(a + 1) + ... + d(a + b). |
| |
Definition |
| | | Class: | ProperDivisors | | Method: | analyzeInterval | | Parameters: | int, int, int | | Returns: | int | | Method signature: | int analyzeInterval(int a, int b, int n) | | (be sure your method is public) |
|
| |
|
| |
Notes |
| - | The result will always fit into a signed 32-bit integer. |
| |
Constraints |
| - | a will be between 1 and 1000000 (10^6), inclusive. |
| - | b will be between 1 and 10000000 (10^7), inclusive. |
| - | n will be between 2 and 10, inclusive. |
| |
Examples |
| 0) | |
| | | Returns: 5 | | The cool divisors of 32 are 4, 8 and 16 so d(32) = 3; the cool divisors of 33 are 3 and 11 so d(33) = 2. Hence the desired sum d(32) + d(33) = 3 + 2 = 5. |
|
|
| 1) | |
| | |
| 2) | |
| | |