Problem Statement |
| | A number is called "almost prime" if it is a power of a prime number, but is not a prime number itself. Note that 1 is not almost prime. You are given two Strings A and B, both representing integers (without leading zeros). Return the number of integers between A and B, inclusive, that are almost prime. |
| |
Definition |
| | | Class: | AlmostPrime | | Method: | count | | Parameters: | String, String | | Returns: | int | | Method signature: | int count(String A, String B) | | (be sure your method is public) |
|
| |
|
| |
Constraints |
| - | A will represent an integer between 1 and 10^14, inclusive. |
| - | B will represent an integer between A and 10^14, inclusive. |
| - | Both A and B will have no leading zeros. |
| |
Examples |
| 0) | |
| | | Returns: 3 | | 4, 8 and 9 are almost prime here. |
|
|
| 1) | |
| | |
| 2) | |
| | |