Tricknology
InterviewTime limit1sMemory limit1024 MB
For each query L R, count pairs x < y within [L, R] where the sum of all integers from x to y is prime.
- Level
Medium4 of 10
- Topics
- Number theory, Prefix sum, Math
- Solved
- No attempts yet
Problem
Write a program that performs the following query.
- : For integers and that satisfy , output the number of integer pairs for which the sum of all natural numbers with is a prime number.
Input
The first line contains the number of queries .
Each of the next lines contains one query, given as two positive integers and .
Output
For each query, print the answer on its own line.