Skip to content

Implementation of Hardy Ramanujan Algorithm in /maths - #1355

Merged
cclauss merged 6 commits into
TheAlgorithms:masterfrom
alfinwilliam:master
Oct 19, 2019
Merged

Implementation of Hardy Ramanujan Algorithm in /maths#1355
cclauss merged 6 commits into
TheAlgorithms:masterfrom
alfinwilliam:master

Conversation

@alfinwilliam

@alfinwilliamalfinwilliam commented Oct 13, 2019

Copy link
Copy Markdown
Contributor

Fixes: #1356

@cclauss

Copy link
Copy Markdown
Member

Please add doctests as discussed in CONTRIBUTING.md.

@alfinwilliam

Copy link
Copy Markdown
ContributorAuthor

Added docstrings & doctests as mentioned in CONTRIBUTING.md

@cclausscclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

doctest please

Comment threadmaths/hardy_ramanujanalgo.py Outdated
@@ -0,0 +1,46 @@

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

# please.

Comment threadmaths/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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

# please...

Comment threadmaths/hardy_ramanujanalgo.py Outdated


def exactPrimeFactorCount(n) :
count = 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add a doctest?

Comment threadmaths/hardy_ramanujanalgo.py Outdated

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

Copy link
Copy Markdown
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.

Comment threadmaths/hardy_ramanujanalgo.py Outdated
def exactPrimeFactorCount(n) :
count = 0
if (n % 2 == 0) :
count = count + 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

count += 1

Comment threadmaths/hardy_ramanujanalgo.py Outdated
count = 0
if (n % 2 == 0) :
count = count + 1
while (n % 2 == 0) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the ()

Comment threadmaths/hardy_ramanujanalgo.py Outdated

i = 3

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the ()

Comment threadmaths/hardy_ramanujanalgo.py Outdated
i = 3

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the ()

Comment threadmaths/hardy_ramanujanalgo.py Outdated

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove the ()

Comment threadmaths/hardy_ramanujanalgo.py Outdated
#number n is greater than 2

if (n > 2) :
count = count + 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+=

@cclauss
cclauss merged commit 5c351d8 into TheAlgorithms:masterOct 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 freeto 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

@alfinwilliam@cclauss