Skip to content
Browse files

Euler 7

  • Loading branch information...
1 parent 935b7c9 commit 55131d75ca869d0d1ea24cd34db9d5ffdba5ccf8 @akshar-raaj committed Jul 10, 2011
Showing with 41 additions and 0 deletions.
  1. +41 −0 euler7.html
View
41 euler7.html
@@ -0,0 +1,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>

0 comments on commit 55131d7

Please sign in to comment.
Something went wrong with that request. Please try again.