Submit | All submissions | Best solutions | Back to list |
FARPRIME - Far From Primes |
A prime number is an integer greater than 1 that has no positive divisors other than 1 and itself. The first prime numbers are 2, 3, 5, 7, 11, 13, 17, ...
The number N is considered far from primes if there are no prime numbers between N-10 and N+10, inclusive, i.e., all numbers N-10, N-9, ..., N-1, N, N+1, ..., N+9, N+10 are not prime.
You are given an int A and an int B. Find and print the number of far from primes numbers between A and B, inclusive. A will be between 10 and 100000, inclusive. B will be between A and 100000, inclusive.(B - A) will be between 0 and 1000, inclusive.
Input Specification
The input will contain several test cases, each test cases will be in a single line containing A and B.
Output Specification
Print one line per test case with the answer, follow the format below
Input Example
3328 4100
10 1000
19240 19710
23659 24065
97001 97691
Output Example
4
0
53
20
89
Added by: | Fabio Avellaneda |
Date: | 2013-02-02 |
Time limit: | 3s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C C++ 4.3.2 CPP JAVA |
Public source code since: | 2013-02-21 06:00:00 |