Skip to content

Conversation

SenayYakut
Copy link

Might be useful

@SenayYakut
Copy link
Author

I like to contribute to the project uploading the example questions and my solutions in javascript

@SenayYakut
Copy link
Author

function printPrime(value) {
var primes = [];
for(var i = 2; i < value; i++) {
primes[i] = true;
}
var limit = Math.sqrt(value);
for(var i = 2; i < limit; i++) {
if(primes[i] === true) {
for(var j = i * i; j < value; j += i) {
primes[j] = false;
}
}
}
for(var i = 2; i < value; i++) {
if(primes[i] === true) {
console.log(i + " " + primes[i]);
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant