# Matrix Sieve- new algorithm for finding primes

Email
 Submitted on: 8/1/2015 9:53:24 AM By: Boris Sklyar Level: Advanced User Rating: Unrated Compatibility: C++ (general) Views: 2747

Calculates prime numbers in sequences S1=6p+5 and S2=6p+7, p=0,1,2,3,...up to N=2*10^19 in the range up to N2-N1=10^6 on the base of derived "matrix definition" of primes.

code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 ``` //************************************** // Name: Matrix Sieve-new algorithm for finding primes // Description:Calculates prime numbers in sequences S1=6p+5 and S2=6p+7, p=0,1,2,3,...up to N=2*10^19 in the range up to N2-N1=10^6on the base of derived "matrix definition" of primes. // By: Boris Sklyar //************************************** #include #include #include #include using namespace std; main( ) { /* 1S MATRIX SIEVE*/ /*FINDING PRIMES IN THE RANGE (N1;N2) in sequence S1=6*P*+5*/ /*Authors: B.Sklyar, D.Sklyar, I.Sklyar*/ /* N1>7; N2<2 000 000 000 000 000 000; N2-N1< 1 000 000*/ unsigned long long int N1=111222333444555000; unsigned long long int N2 =111222333444555900; unsigned long long int pr1=floor(N1/6); unsigned long long int pr2=ceil( N2/6); int q=170000; int R2[q] ; int qm=pr2-pr1; unsigned long long int S1[q] ; int q2, q1; for (q=1;qpr1)&&( P1pr1)&&( P2 #include #include #include using namespace std; main( ) { /* 2S MATRIX SIEVE*/ /*FINDING PRIMES IN THE RANGE (N1;N2) in sequence S2=6*P*+7*/ /*Authors: B.Sklyar, D.Sklyar, I.Sklyar*/ /* N1>7; N2<2 000 000 000 000 000 000; N2-N1< 1 000 000*/ unsigned long long int N1=111222333444555000; unsigned long long int N2 =111222333444555900; unsigned long long int pr1=floor(N1/6); unsigned long long int pr2=ceil( N2/6); int r=170000; int R2[r] ; int rm=pr2-pr1; unsigned long long int S2[r] ; int r2, r1; for (r=1;rpr1)&&( P1pr1)&&( P2

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)