Primes in Range

View as PDF

Submit solution

Points: 3
Time limit: 1.5s
Memory limit: 64M

Author:
Problem types

A number is prime if it has exactly two divisors: itself and 1.
You are given a range from a to b, inclusive. Output every prime number that falls in the range.

Input Specification

The first and only line of input contains a and b (-10000\le a,b \le 10000), representing the lower and upper bounds of the range respectively.
(a \le b)

Output Specification

The output should include every prime number between a and b inclusive, separated by whitespaces .

Sample Input 1

12 29

Sample Output 1

13 17 19 23 29

Sample Input 2

0 8

Sample Output 2

2 3 5 7

Comments

There are no comments at the moment.