TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

The Prime Minister and his Accumulated Council of Ministers(ACM) are trying hard to find all
possible terrorist locations. In his dream, the Prime Minister gets a message from God suggesting
that the answer to all terrorist problems are numbers (say one such number is X) such that the
number of factors of X(including 1 and X) is prime. These numbers supposedly contain the
encrypted locations of terrorists. Since the ACM has no programmer, the Prime Minister needs
your help in finding out such numbers.


Note: 1 is not considered a prime number.

Input Format

The first line of input will contain an integer T <= 20 denoting the number of test cases.
T lines follow, one per test case.

Each test case will be a line formatted as "L H" where L and H are integers and 0<=H<=10000

Output Format

Output one line per case a space separated list of all integers(sorted ascending) lying between L
and H (both inclusive) such that the number of factors of each integer is prime. In case no such
integer exist output -1.

Sample Input 1

3
1 1
1 2
2 5

Sample Output 1

-1
2
2 3 4 5

Hints

Problem Source

Migrated from old NTUJ.

ICPC 2008, Amritapuri

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 5000 65536 200