DAYOUT2H - How Many Primes

no tags 

Find out how many prime numbers are there between two numbers.

২টি সংখ্যার মধ্যে কতগুলো প্রাইম নাম্বার আছে বের করো ।

Input

The first line of input file contains the number of test cases T (T ≤ 25). Each test case contains two positive integers A and B where 1 ≤ A ≤ B ≤ 1000.

ইনপুট ফাইলের প্রথম লাইনে থাকবে টেস্ট কেসের সংখা T (T≤২৫)। প্রতিটি টেস্ট কেসে ২টি করে ধনাত্মক সংখ্যা থাকবে A এবং B, যেখানে ১≤A≤B≤১০০০।

Output

●     For each case, print one line of output like “Case X: N”, without the quotes, where X is the number of test case starting from 1 and N is number of prime numbers which are greater than or equal to A and less than or equal to B.

●     Check the sample input and output for more details.

●     প্রতি কেসের জন্যে এক লাইনের আউটপুট প্রিন্ট করতে হবে "Case X: N" এর মত করে। কোটেশন চিহ্ন ছাড়া, যেখানে X হচ্ছে ১ থেকে শুরু করে টেস্ট কেসের সংখ্যা এবং N হচ্ছে A থেকে বড় বা সমান এবং B থেকে ছোটো বা সমান কত গুলো প্রাইম নাম্বার আছে তার  সংখ্যা ।

●     নমুনা আউটপুটে আরো বিস্তারিত দেখতে পারো।

Example

Input:
3
10 20
30 40
50 100

Output:
Case 1: 4
Case 2: 2
Case 3: 10

hide comments
nadstratosfer: 2018-06-19 09:20:26

"Between" here refers to a closed interval.

2
29 29
29 31

Output:
Case 1: 1
Case 2: 2

OoOE: 2013-03-07 18:29:02

I don't understand why this simple problem is giving 'wrong answer'...


Added by:Shafaet
Date:2013-01-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own problem