Prime Number pair conjecture and prime number conjecture

Source: Internet
Author: User

Prime Number pair conjecture and prime number conjecture

1 # include <stdio. h> 2 # include <stdlib. h> 3 # include <math. h> 4 # define MAX 100000 5 int a [MAX]; 6 int isprime (int num); 7 int main () 8 {9 int num, I; 10 scanf ("% d", & num); 11 memset (a, 0, MAX); 12 a [0] = 2; 13 int c1 = 0, c2 = 0; 14 for (I = 3; I <= num; I ++) {15 if (isprime (I) {16 c1 ++; 17 a [c1] = I; 18 if (a [c1]-a [c1-1] = 2) 19 {20 c2 ++; 21} 22} 23} 24 printf ("% d", c2 ); 25 return 0; 26} 27 28 29 int isprime (int num) {30 int flag = 1, I; 31 for (I = 2; I <= sqrt (num ); I ++) 32 {33 if (num % I = 0) flag = 0; 34} 35 return flag; 36}

 

Related Article

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.