All Tracks Math Number Theory Basic Number Theory-1 Problem

Mogu Loves Numbers
Tag(s):

Easy

Problem
Editorial
Analytics

Mogu loves those numbers that have the following property:-

  1. The number of divisors of the number are even.
  2. The number of divisors of the number are prime.

Given $$L$$ and $$R$$, Mogu needs to find the count of numbers between $$L$$ and $$R$$ inclusive that follow the above properties.

As Mogu was unable to make it to the IUPC round 1 in Plinth '17, he has asked you to report the answer back to him.

Note: Both the properties should hold.

$$Input :$$

First line of the Input contains an integer $$Q$$ denoting the number of queries. Each of the next $$Q$$ lines contain $$2$$ integers $$L$$ and $$R$$.

$$Output :$$

Output the count of such numbers in the range $$L$$ and $$R$$ inclusive that follow the given properties for each query.

$$Constraints$$ :

$$1 \le Q \le 10^6$$

$$1 \le L \le 10^6$$

$$1 \le R \le 10^6$$

$$L$$ can be $$\gt R$$.

SAMPLE INPUT
2
2 3
6 9
SAMPLE OUTPUT
2
1
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic, Kotlin

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications