-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
64 lines (62 loc) · 2.48 KB
/
index.html
File metadata and controls
64 lines (62 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./style.css"/>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8=" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<table id="table">
</table>
</div>
<div class="col-md-6">
<h1>Sieve of Eratosthenes</h1>
<p>
Sieve of Eratosthenes is a famous simple algorithm use to find all the primes nos. upto certain limit.
</p>
<h3>Algorithm:</h3>
<ol>
<li>
Intialize an array of size n with all the values 1(where n is limit upto which prime number needed).
</li>
<li>
Set arr[0] and arr[1] as 0 as they are not prime.
</li>
<li>
Intialize p as 2.
</li>
<li>
While p*p is less than equal to n.
<ol type="A">
<li>If arr[p]==1
<ol type="i">
<li>Intialize j to p+p</li>
<li>while j is less than equal to n
<ol type="I">
<li>arr[j]=0</li>
<li>j=j+p</li>
</ol>
</li>
</ol>
</li>
<li>p=p+1</li>
</ol>
</li>
</ol>
<button cl id="start" class="btn btn-info form-control">Start Visulaization</button>
<br/>
<br/>
<button id="reset" class="btn btn-info form-control">Reset</button>
<br/>
<br/>
<p id="step"></p>
<div id="prime"></div>
</div>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>