Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

Let us call a number prime? if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are prime?, while 4, 8, 9, 42 are not. Find the number of prime? numbers which are between 1 and ‘N’, inclusive.

```
‘N’ = 7
6 is the only prime? number in 1-7. So, the answer is 1.
```

Detailed explanation

```
The first line contains a single integer ‘T’ denoting the number of test cases, then the test case follows.
The first line of each test case contains a single integer, ‘N’.
```

```
For each test case, return a single integer, the number of prime? numbers between 1 and ‘N’ (inclusive).
Output for each test case will be printed on a separate line.
```

```
You are not required to print anything; it has already been taken care of. Just implement the function.
```

```
1 ≤ T ≤ 10
1 ≤ N ≤ 500
Time limit: 1 sec
```

```
2
10
5
```

```
2
0
```

```
For the first test case, 6 and 10 are the prime? Numbers. 6 = 3x2 and 10 = 5x2
For the second test case, there are no prime? Numbers till 5.
```

```
2
12
20
```

```
3
7
```