Skip to content

Conversation

@seemcat
Copy link
Contributor

@seemcat seemcat commented Jun 15, 2017

No description provided.

if(num === 1 || num === 0 || num === -1){
return false;
}
for(let i = 2; i < Math.sqrt(num); i++){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using a specific algorithm that may not be known to general audience, it is good practice to leave a comment explaining the algorithm. In this case, the comment can say Trial division test for Primality: divide from 2 to the square root of the number

};

const solution1 = (num) => {
if(num === 1 || num === 0 || num === -1){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rewrite this condition so that it can handle num like -2? or -3452?

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.

2 participants