SNGPG - Prime Generator The Easiest Question Ever
Prime number questions are always being favorite to everyone. This question is extension to the problem PRIME GENERATOR. The question is very very simple and easier than that you cannot imagine. You have to count total number of such primes p in the range [a ≥ 0, b > 0] so that (p2 + 1) or/and (p2 + 2) is/are prime(s).
First line of input is t, (t < 100) total number of test cases. Next t lines contains two integers a and b seperated by space.
a < 50001, b < 100001 and b > a.
In each line print total numbers of such prime numbers.
4 5 Output: 2
[Consider 0 and 1 as prime numbers for this question]
Just observe and get 0.00s. :-)
took less than 15 min to solve and code !! tutorials -->
NotUsingPenAndPaper Solution - 0.81s
python 3 lines..AC in 1st attempt
easiest question ever!!!! my 50 th :)
Though i got an AC , i'm still confused because if i giv input 0 9 it gives me ans of 4
simplest problem ever got ac in 0.00 :D
Last edit: 2015-08-31 20:37:45
Time limit way too high, with precomputation it takes 0.04s in C++, and the simplest bruteforce without precomputation takes 1.64 :PLast edit: 2015-08-31 18:19:11