Skip to content

Commit b3f12f0

Browse files
authored
Update seive of eratosthenes(final).cpp
1 parent 39c2072 commit b3f12f0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

seive of eratosthenes(final).cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// Department of Computer Science ///
55
/// & Engineering ///
66
/// Comilla University , Bangladesh.
7-
/// This is a very efficient Seive of Eratothenes implementation
7+
///
88
///...................................*****.................................................///
99

1010
/*....................................Values................................................*/
@@ -98,7 +98,11 @@ bool valid( int r , int c , int x , int y ){ if( x >= 1 && x <= r && y >= 1 && y
9898
using namespace std;
9999
bool arr[100000003];
100100
vecl v;
101-
void seive(int n)
101+
102+
// This is a very efficient seive of eratothenes. Time complexity: O(nloglogn) .
103+
// Can store 5*10^6 prime numbers below 10^8 on c++14 ideone compiler.
104+
105+
void seive(int n)
102106
{
103107
lli root=sqrt(n)+1,p,i,j;
104108
arr[0]=arr[1]=1;

0 commit comments

Comments
 (0)