Skip to content

Conversation

ZainabMalik5
Copy link

I have added a file for computing all unique divisors of a number in javascript in Maths folder. Please merge my PR.

Copy link
Contributor

@gaurovgiri gaurovgiri left a comment

Choose a reason for hiding this comment

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

The algorithm implementation looks good to me. However, there are few suggestions I would like to provide:

  1. The function name is printDivisors(), but it doesn't prints anything, just returns a list of divisors. I suggest to change it to something like getDivisors().
  2. Change variable name into something meaningful .
  3. Also add documentations comment.
@ZainabMalik5 ZainabMalik5 reopened this Oct 5, 2023
@ZainabMalik5
Copy link
Author

ZainabMalik5 commented Oct 7, 2023 via email

@appgurueu appgurueu mentioned this pull request Oct 7, 2023
@ZainabMalik5
Copy link
Author

Please merge PR #1435 if it's fine.

Copy link
Contributor

@gaurovgiri gaurovgiri left a comment

Choose a reason for hiding this comment

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

Great Work! Keep it up!

Copy link
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

Missing tests. @return{Vector} should be @return{[]Integer} (Integer is treated as an undefined custom type; we could use number, but that doesn't convey the same information. Ideally consider @typedefing Integer).

I'm also not sure how useful this algorithm is given that we already have prime factorization. (This gives you all divisors of a number, but I think that is almost always less useful than prime factorization.)

@ZainabMalik5
Copy link
Author

I have made the necessary changes in Divisors.js. Please review it.

* @description Generate all unique divisors of a number.
* @param {Integer} num
* @return{[]Integer} divisors
* @example{10-1,2,5,10}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This example is broken

@appgurueu
Copy link
Collaborator

I have made the necessary changes in Divisors.js. Please review it.

It's still missing tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants