Skip to content

Fixes: #3163 - Add new solution for problem 234 #3177

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 2 commits into from
Oct 11, 2020

Conversation

Hyftar
Copy link
Contributor

@Hyftar Hyftar commented Oct 11, 2020

Describe your change:

Fixes the Project Euler problem 234 by implementing a new working solution that doesn't use any input() calls.

This PR closes #3163

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@Hyftar Hyftar requested a review from dhruvmanila as a code owner October 11, 2020 04:42
@dhruvmanila dhruvmanila added the awaiting changes A maintainer has requested changes to this PR label Oct 11, 2020
@Hyftar Hyftar requested a review from dhruvmanila October 11, 2020 16:34
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for doing this.

@dhruvmanila dhruvmanila merged commit 60f9895 into TheAlgorithms:master Oct 11, 2020
is_prime[2] = True

for i in range(3, int(n ** 0.5 + 1), 2):
index = i * 2
Copy link

@gurukiran07 gurukiran07 Oct 11, 2020

Choose a reason for hiding this comment

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

In L39 index = i*i is one optimization here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While you are most likely right:

  • The sieves of Eratosthenes is not my algorithm;
  • Optimizing the sieves of Eratosthenes is out of the scope of my PR;
  • The Pull Request is already merged.

@Hyftar Hyftar deleted the problem-234-fix branch October 11, 2020 17:55
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
…rithms#3177)

* Fixes: TheAlgorithms#3163 - Add new solution for problem 234

* Apply review suggestions
Panquesito7 pushed a commit to Panquesito7/Python that referenced this pull request May 13, 2021
…rithms#3177)

* Fixes: TheAlgorithms#3163 - Add new solution for problem 234

* Apply review suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes A maintainer has requested changes to this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix needed for Project Euler problem 234 sol1.py
3 participants