Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test & solution for #59 (MERGE CONFLICTS RESOLVED) #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Test & solution for #59 (MERGE CONFLICTS RESOLVED) #105

wants to merge 1 commit into from

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

@@ -19,6 +21,20 @@ const solution = (num) => {
}
return true;
};

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