1007. Conjecture of prime number pairs (20) Time Limit 400 MS
Memory limit 32000 KB
CodeLength limit 8000 B
JudgementProgram Standard Author Chen, Yue
Let's define DN as: DN = pN + 1-PN, where Pi is the I prime number. Obviously, d1 = 1 and for n> 1, dn is an even number. The "prime number pair conjecture" considers "There are infinite numbers of adjacent prime numbers with a difference of 2 ".
Given any positive integer N (<105), calculate the number of prime number pairs that do not exceed n.
Input Format:Each test input contains one test case and a positive integer n.
Output Format:The output of each test case occupies one row. The number of prime number pairs that meet the conjecture cannot exceed n.
Input example:
20
Output example:
4
# include
# include
# include
# include
# define maxsize 100000 using namespace STD; int prime [maxsize]; int main () {memset (Prime, 0, maxsize); int N, I, j; int K = 0; vector
VEC; vector
: iterator it1, it2; int M = (INT) (SQRT (double (maxsize) + 0.5); CIN> N; for (I = 2; I