![]() |
VOOZH | about |
Given an integer N, the task is to find the count of all possible integers less than N satisfying the following properties:
Examples:
Input: N = 10
Output: 3
Explanation:
All possible integers which are less than 10 and are neither divisors nor coprime with 10, are {4, 6, 8}.
Therefore, the required count is 3.
Input: N = 42
Output: 23
Approach:
Follow the steps below to solve the problem:
Total count = N - Euler's totient(N) - Divisor count(N)
Below is the implementation of the above approach:
23
Time Complexity: O(N*log(log(N)))
Auxiliary Space: O(N)