Created
November 12, 2011 17:02
-
-
Save jakedobkin/1360817 to your computer and use it in GitHub Desktop.
Euler 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script type="text/javascript"> | |
primecount=1; | |
i=3; | |
while (primecount < 10001) | |
{ | |
isprime = true; | |
for (j=2; j<=Math.sqrt(i); j++) | |
{ | |
if (i%j == 0) | |
{ | |
isprime = false; | |
// document.write(i + "is not prime<br/>"); | |
break; | |
} | |
} | |
if (isprime == true) | |
{ | |
lastprime=i; | |
primecount++; | |
// document.write(i + " is prime number " + primecount + "<br/>"); | |
} | |
i+=2; | |
} | |
document.write(lastprime + " is the " + primecount + "prime number"); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment