Semi-prime godebach conjecture (any number greater than six can be written as the sum of two odd prime numbers)

Source: Internet
Author: User

The question defines a number called a half prime number: As long as a number can be divided into two prime numbers, this number is a half prime number.
Prime Number Definition
An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. for instance, 2, 11, 67, 89 are prime numbers but 8, 20, 27 are not.

Semi-prime number Definition
An integer greater than one is called a semi-prime number if it can be decompoundedTwoPrime numbers. For example, 6 is a semi-prime number but 12 is not.

Your task is just to determinate whether a given number is a semi-prime number.

Input

There are several test cases in the input. Each case contains a single integer N (2 <= n <= 1,000,000)

Output

One line with a single integer for each case. If the number is a semi-prime number, then output "yes", otherwise "no ".

Sample Input

3
4
6
12

Sample output
No
Yes
Yes
No

The solution is very simple. The solution is as follows:

# Include <iostream> # include <cmath> using namespace STD; bool isprime (long test) {int I; for (I = 2; I <= SQRT (Long Double) test); I ++) {If (test % I = 0) return false;} return true;} bool issemiprime (long test) {int I; for (I = 2; I <= SQRT (Long Double) Test); I ++) {If (test % I = 0) {int temp = test/I; return isprime (I) & isprime (temp) ;}} return false ;}int main () {long n; while (CIN >>n & n! = 0) {If (issemiprime (N) cout <"yes" <Endl; elsecout <"no" <Endl ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.