Number that are not divisible
Easy Accuracy: 23.63% Submissions: 72 Points: 2

You will be given a positive integer N. Your task is to find the number of positive integers K ≤ N such that K is not divisible by any number among the set {2,3,4,5,6,7,8,9,10}.

 

Example 1:

Input:
N = 11
Output:
2
Explanation:
1 and 11 are the only possible solutions.

Example 2:

Input:
N = 2
Output:
1
Explanation:
1 is the only possible solution.

 

Your Task:
You don't need to read input or print anything. Your task is to complete the function noOfNumbers() which takes an Integer N as input and returns the answer.

 

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

 

Constraints:
1 <= N <= 1018

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Number that are not divisible

Output Window