Problem Statement
A number is called square-free if it is not divisible by a perfect square which is greater than one. A perfect square is the square of an integer. Return the number of square-free numbers between min and max, inclusive.
Definition
- Class:
- SquareFreeNumbers
- Method:
- getCount
- Parameters:
- long, long
- Returns:
- int
- Method signature:
- int getCount(long min, long max)
- (be sure your method is public)
Constraints
- min will be between 1 and 1,000,000,000,000, inclusive.
- max will be between min and (min + 1,000,000), inclusive.
Examples
1
10
Returns: 7
Numbers 4, 8 and 9 are not square-free.15
15
Returns: 1
min and max can be equal.1
1000
Returns: 608