Skip to content
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

Another solution for Project Euler problem 145 #9045

Closed
wants to merge 2 commits into from
Closed

Another solution for Project Euler problem 145 #9045

wants to merge 2 commits into from

Conversation

the-other-sunny
Copy link

@the-other-sunny the-other-sunny commented Sep 8, 2023

Describe your change:

There is my solution for Project Euler problem 145.
The problem currently ranks as the slowest one to compute according to the Github Actions logs.
On my machine, the main function runs in 3µs, which should help drastically with #8594.
The explanation is pretty lenghty, if there's anything that needs to be removed or added I would be glad to fix it.

  • 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 include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@the-other-sunny
Copy link
Author

@dhruvmanila would you have time to check my pull request? Or guide me to someone that could help?

@the-other-sunny
Copy link
Author

the-other-sunny commented Sep 29, 2023

@cclauss @tianyizheng02 sorry for bothering, but can someone check my code? It's been almost a month since I opened the pull request and never received any sort of feedback.

@cclauss
Copy link
Member

cclauss commented Sep 29, 2023

@dhruvmanila Do we accept multiple algorithms for a single Euler problem?

@the-other-sunny Is this solution faster, shorter, or easier to understand than the current solution?

@the-other-sunny
Copy link
Author

the-other-sunny commented Sep 29, 2023

@cclauss thank you for your reply.

This solution is significantly faster than the previous one. I ran a benchmark on my machine:

The time complexity of the previous solution seems at least exponential in the considered number of digits. This solution has a linear time complexity that can easily be improved into a logarithmic / constant complexity.

The code is fairly simple, just defining a few constants that are then used in basic calculations.
The lenghty part is the solution's explanation, which is missing on the other solution.

If any clarifications or improvements are needed, I'd be glad both to conduct them or let someone else take care of it.

@cclauss cclauss closed this Sep 30, 2023
@the-other-sunny
Copy link
Author

@dhruvmanila @cclauss

Quite disappointed with the way things unfolded here.

I invested a significant amount of time into this, making sure the solution is well explained and efficient. I closely followed the provided guidelines. I addressed an issue that was marked with a "help wanted" tag.

All I received is a noticeable lack of consideration.

@cclauss
Copy link
Member

cclauss commented Sep 30, 2023

Hacktoberfest just began and we had 50 open pull requests so I closed them all enmasse before we are overwhelmed. It is not personal… just defending the sanity of volunteers. In general we do not need many ways to solve the same problem unless there is serious differentiation.

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.

2 participants