Skip to content

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