-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Implementation of Hardy Ramanujan Algorithm in /maths #1355
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
Conversation
Please add doctests as discussed in CONTRIBUTING.md. |
Added docstrings & doctests as mentioned in CONTRIBUTING.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doctest please
maths/hardy_ramanujanalgo.py
Outdated
@@ -0,0 +1,46 @@ | |||
|
|||
#It's a theorem that states the number of prime factors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# please.
maths/hardy_ramanujanalgo.py
Outdated
|
||
#It's a theorem that states the number of prime factors | ||
# of n will approximately be log(log(n)) for most | ||
#natural numbers n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# please...
maths/hardy_ramanujanalgo.py
Outdated
|
||
|
||
def exactPrimeFactorCount(n) : | ||
count = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a doctest?
maths/hardy_ramanujanalgo.py
Outdated
|
||
def exactPrimeFactorCount(n) : | ||
count = 0 | ||
if (n % 2 == 0) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the ()... This is Python, not JavaScript.
maths/hardy_ramanujanalgo.py
Outdated
def exactPrimeFactorCount(n) : | ||
count = 0 | ||
if (n % 2 == 0) : | ||
count = count + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count += 1
maths/hardy_ramanujanalgo.py
Outdated
count = 0 | ||
if (n % 2 == 0) : | ||
count = count + 1 | ||
while (n % 2 == 0) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the ()
maths/hardy_ramanujanalgo.py
Outdated
|
||
i = 3 | ||
|
||
while (i <= int(math.sqrt(n))) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the ()
maths/hardy_ramanujanalgo.py
Outdated
i = 3 | ||
|
||
while (i <= int(math.sqrt(n))) : | ||
if (n % i == 0) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the ()
maths/hardy_ramanujanalgo.py
Outdated
|
||
#this condition checks the prime | ||
#number n is greater than 2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the ()
maths/hardy_ramanujanalgo.py
Outdated
#number n is greater than 2 | ||
|
||
if (n > 2) : | ||
count = count + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+=
…1355) * Implementation of Hardy Ramanujan Algorithm * added docstrings * added doctests * Run Python black on the code * Travis CI: Upgrade to Python 3.8 * Revert to Python 3.7
Fixes: #1356