Skip to content

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

Merged
merged 6 commits into from
Oct 19, 2019

Conversation

alfinwilliam
Copy link
Contributor

@alfinwilliam alfinwilliam commented Oct 13, 2019

Fixes: #1356

@cclauss
Copy link
Member

cclauss commented Oct 18, 2019

Please add doctests as discussed in CONTRIBUTING.md.

@alfinwilliam
Copy link
Contributor Author

Added docstrings & doctests as mentioned in CONTRIBUTING.md

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

doctest please

@@ -0,0 +1,46 @@

#It's a theorem that states the number of prime factors
Copy link
Member

Choose a reason for hiding this comment

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

# please.


#It's a theorem that states the number of prime factors
# of n will approximately be log(log(n)) for most
#natural numbers n
Copy link
Member

Choose a reason for hiding this comment

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

# please...



def exactPrimeFactorCount(n) :
count = 0
Copy link
Member

Choose a reason for hiding this comment

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

Add a doctest?


def exactPrimeFactorCount(n) :
count = 0
if (n % 2 == 0) :
Copy link
Member

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.

def exactPrimeFactorCount(n) :
count = 0
if (n % 2 == 0) :
count = count + 1
Copy link
Member

Choose a reason for hiding this comment

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

count += 1

count = 0
if (n % 2 == 0) :
count = count + 1
while (n % 2 == 0) :
Copy link
Member

Choose a reason for hiding this comment

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

Remove the ()


i = 3

while (i <= int(math.sqrt(n))) :
Copy link
Member

Choose a reason for hiding this comment

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

Remove the ()

i = 3

while (i <= int(math.sqrt(n))) :
if (n % i == 0) :
Copy link
Member

Choose a reason for hiding this comment

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

Remove the ()


#this condition checks the prime
#number n is greater than 2

Copy link
Member

Choose a reason for hiding this comment

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

Remove the ()

#number n is greater than 2

if (n > 2) :
count = count + 1
Copy link
Member

Choose a reason for hiding this comment

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

+=

@cclauss cclauss reopened this Oct 19, 2019
@cclauss cclauss merged commit 5c351d8 into TheAlgorithms:master Oct 19, 2019
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
…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
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.

Merge implementation of Hardy_Ramanujan Algorithm in /maths
2 participants