-->
当前位置:首页 > 题库 > 正文内容

编程题:_October's prime number

Luz4年前 (2021-11-24)题库639
A positive integer is called a prime if it is greater than 1 and cannot be written as the product of two smaller positive integers.

Let's define the function f(x) as the smallest prime which is strictly larger than x. For example, f(1)=2, f(2)=3, and f(3)=f(4)=5. And we use $$⌊x⌋$$ to indicate the largest integer that does not exceed x.

\_Octoer comes again. Now after he studying this, he has a problem want you to help him solve it.

Now given x, please determine whether g(x) is a prime.
$$g(x)=\left\lfloor\dfrac{f(x)+f(f(x))}{2}\right\rfloor
$$

Tips: you can try to count by yourself for first few numbers and then you will find rules...

### INPUT:

The first line of the input contains an integer n $$(1 \le n \le 10^3)$$, indicating the number of test cases.

Each test case contains an integer x $$ (1 \le x \le 10^{18} ) $$in a single line.

### OUTPUT:

For each test case, if $$g(x)$$ is a prime, output **YES** in a single line. Otherwise, output **NO** in a single line.

### SAMPLE INPUT:

in
2
1
2


### SAMPLE OUTPUT:

out
YES
NO







答案:若无答案欢迎评论

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。