-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheuler7.html
More file actions
41 lines (40 loc) · 923 Bytes
/
euler7.html
File metadata and controls
41 lines (40 loc) · 923 Bytes
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
<html>
<head>
<script type="text/javascript">
function find_required_prime(n)
{
var i=0;
var required_prime;
var number=2;
while(i<n)
{
if(isPrime(number))
{
//alert("Prime "+number);
i++;
}
number++;
}
number--;
alert(n+"st prime is "+number);
}
function isPrime(num)
{
sqrt=Math.pow(num,0.5);
sqrt=Math.floor(sqrt);
iP=2;
while(iP<=sqrt)
{
if(num%iP==0)
{
return false;
}
iP++;
}
return true;
}
</script>
</head>
<body onload="find_required_prime(10001);">
</body>
</html>