Defuse the bomb
All submissions for this problem are available.
El Macho has set the bomb and tied Lucy with it. To save Lucy , Gru has to defuse the bomb. The bomb displays 2 numbers a & b, and its diffusal code is the count of numbers in range [a,b] (both inclusive) having the following properties :
1. The number should be prime.
2. It can be written as the sum of squares of 2 positive integers ( number = p^2 + q^2).
Help Gru to save Lucy by telling him the diffusal code.
First line contains T : Number of test cases followed by T line containing 2 space separated integers a and b.
One line per test case containing the count of numbers in the [a,b] having the above properties.
- 1 ≤ T ≤ 10
- 1 ≤ a ≤ b ≤ 10^9
Input: 1 1 5 Output: 2
2 = 1^2 + 1^2
5 = 1^2 + 2^2
|Time Limit:||0.119767 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions