X Tutup
The Wayback Machine - https://web.archive.org/web/20201016042204/https://github.com/TheAlgorithms/Python/issues/2695
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

Add more solutions to Project Euler problems #2695

Open
aceking007 opened this issue Oct 3, 2020 · 23 comments
Open

Add more solutions to Project Euler problems #2695

aceking007 opened this issue Oct 3, 2020 · 23 comments

Comments

@aceking007
Copy link

@aceking007 aceking007 commented Oct 3, 2020

Project Euler has about 700 problems, but the current repository hosts solutions for only about 60-70 problems.
I'm willing to work on the issue and also if someone wants to help they can join in.
We can create guidelines on how many minimum solutions a PR should have to prevent spammy PRs with just one or two easy solutions. (open to discussion)

@dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Oct 3, 2020

UPDATE: Please read the Project Euler Solution Guidelines for Coding Style before opening a pull request.

UPDATE: Only submit solution to problems which doesn't exists in this repository.

As of now, we are only accepting PRs with one algorithm in it as it is easier to review one file at a time.
Feel free to open PR for whichever problem you have solved provided the answer is correct.

NOTE:

  • Please give us time to review as there are so many to go through. If possible submit one PR at a time and when that is merged provided it passes all the automatic tests, you can submit another PR. Also, please read the contributing guidelines before opening a PR.
  • Please don't mention Fixes: #2695 in your PR or any of your commit. Just put Reference: #2695 in your PR description.

One step at a time

FAQ:

Q: Where can I get the problems from?
https://projecteuler.net/

Q: When there is a program for which input is presented as a file, how should the input be coded?
Should it be hardcoded in the file or should it be reading from a file relative to the directory?
Refer: #2695 (comment)

Q: Hi, can we add solution to any problem?
For now, we are only accepting solutions for problems that do not exist in this repository.
Refer: #2695 (comment)

Q: I am good at mathematics and would like to contribute in this. kindly assign me this work.
Refer: #2695 (comment)

Q: Doesn't the Project Euler website specifically say not to post solutions to the problems publicly?
Refer: #2695 (comment)

@RGarg2002
Copy link

@RGarg2002 RGarg2002 commented Oct 4, 2020

Where can I get the problems from?

@berry-thawson
Copy link

@berry-thawson berry-thawson commented Oct 4, 2020

https://projecteuler.net/
Hope this helps

@RGarg2002
Copy link

@RGarg2002 RGarg2002 commented Oct 4, 2020

Thanks it helped🙂

akshat235 added a commit to akshat235/Python that referenced this issue Oct 4, 2020
Added problem_38 folder with solution file sol.py. TheAlgorithms#2695
@akshat235 akshat235 mentioned this issue Oct 4, 2020
7 of 13 tasks complete
akshat235 added a commit to akshat235/Python that referenced this issue Oct 4, 2020
kalpanajangra added a commit to kalpanajangra/Python that referenced this issue Oct 5, 2020
kalpanajangra added a commit to kalpanajangra/Python that referenced this issue Oct 5, 2020
@sarthaka1310 sarthaka1310 mentioned this issue Oct 5, 2020
11 of 14 tasks complete
@hbarovertwo
Copy link

@hbarovertwo hbarovertwo commented Oct 6, 2020

I would love to join and contribute. Project Euler was always fun to me back in college :)

@berry-thawson
Copy link

@berry-thawson berry-thawson commented Oct 6, 2020

Hi,
When there is a program for which input is presented as a file, how should the input be coded?
Should it be hardcoded in the file or should it be reading from a file relative to the directory?

@dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Oct 6, 2020

@berry-thawson Please refer to problem_54#L367-L369

import os  # with other imports
...

def solution():
    script_dir = os.path.abspath(os.path.dirname(__file__))
    <file_name_without_extension> = os.path.join(script_dir, "<file_name>")
    with open(<file_name_without_extension> , "r") as file_hand:
        # ... your code ...
  • Instead of <file_name> add the name of the file you want to import.
  • Instead of <file_name_without_extension> add the variable name which is descriptive. If possible choose the name as the file name but without the extension.
  • Then using with do whatever you want to do with the contents of the file.

I hope this clears your doubt. If you still have any problem, don't hesitate to ask.

@berry-thawson
Copy link

@berry-thawson berry-thawson commented Oct 6, 2020

Thanks @dhruvmanila
This is helpful

@sarthaka1310 sarthaka1310 mentioned this issue Oct 6, 2020
11 of 14 tasks complete
@appsx13
Copy link

@appsx13 appsx13 commented Oct 7, 2020

Hi, can we add solution to any problem?

@peteryao7 peteryao7 mentioned this issue Oct 8, 2020
10 of 14 tasks complete
peteryao7 added a commit to peteryao7/Python that referenced this issue Oct 8, 2020
@peteryao7 peteryao7 mentioned this issue Oct 8, 2020
10 of 14 tasks complete
peteryao7 added a commit to peteryao7/Python that referenced this issue Oct 8, 2020
@peteryao7 peteryao7 mentioned this issue Oct 8, 2020
13 of 14 tasks complete
ksr1122 pushed a commit to ksr1122/Python that referenced this issue Oct 11, 2020
Name: Divisor Square Sum

For a positive integer n, let σ2(n) be the sum of the squares of its divisors.
For example, σ2(10) = 1 + 4 + 25 + 100 = 130.

Find the sum of all n, 0 < n < 64,000,000 such that σ2(n) is a perfect square.

reference: TheAlgorithms#2695
amy-graham-js pushed a commit to amy-graham-js/Python that referenced this issue Oct 11, 2020
amy-graham-js pushed a commit to amy-graham-js/Python that referenced this issue Oct 11, 2020
@flick-23
Copy link

@flick-23 flick-23 commented Oct 12, 2020

I want to submit my solutions. How do i submit ?

@shubhranshubhoi78
Copy link

@shubhranshubhoi78 shubhranshubhoi78 commented Oct 12, 2020

I'm a keen Euler solver.please let me help in providing efficient solutions to the problems.

heyyviv added a commit to heyyviv/Python that referenced this issue Oct 12, 2020
heyyviv added a commit to heyyviv/Python that referenced this issue Oct 12, 2020
@PetitNigaud PetitNigaud mentioned this issue Oct 13, 2020
10 of 14 tasks complete
@dhruvmanila dhruvmanila mentioned this issue Oct 13, 2020
4 of 4 tasks complete
@bh2smith bh2smith mentioned this issue Oct 13, 2020
10 of 14 tasks complete
@fpringle fpringle mentioned this issue Oct 13, 2020
12 of 14 tasks complete
@maanpatel2492
Copy link

@maanpatel2492 maanpatel2492 commented Oct 14, 2020

@aceking007 In these issue
we have to give a solution to the project Euler problem right?

@deepanshuoct12
Copy link

@deepanshuoct12 deepanshuoct12 commented Oct 14, 2020

hey I also want to join,please can u let me know how many problems we need to solve?and in which language?

@aceking007
Copy link
Author

@aceking007 aceking007 commented Oct 14, 2020

@aceking007 In these issue
we have to give a solution to the project Euler problem right?

@maanpatel2492 Yes. Any project Euler problem that doesn't have a solution yet in the repo.
Please refrain from submitting solutions for previously solved problems and adhere to the recommended guidelines.

@aceking007
Copy link
Author

@aceking007 aceking007 commented Oct 14, 2020

@deepanshuoct12 Submit a PR containing the solution to one unsolved project Euler problem. The language is Python.

@AkshitAggarwal
Copy link

@AkshitAggarwal AkshitAggarwal commented Oct 14, 2020

Doesn't the Project Euler website specifically say not to post solutions to the problems publicly?

@mtbun mtbun mentioned this issue Oct 15, 2020
12 of 14 tasks complete
@aceking007
Copy link
Author

@aceking007 aceking007 commented Oct 15, 2020

@AkshitAggarwal
According to the FAQs, it seems that Project Euler has directly denied everyone to publish the answers to the questions freely.

I learned so much solving problem XXX so is it okay to publish my solution elsewhere?
It appears that you have answered your own question. There is nothing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, however, that will not be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.

But ...

  1. They've got no ownership over your solution. They can make a gentle request that, in the spirit of Project Euler, you will not ruin the challenge for others, but that's all they can do--make a gentle request. In the end, the code is yours, and what you do with it is your decision.
  2. The point of the rule is to prevent the challenge from being ruined for others. If Project Euler questions (and solutions) remain clearly marked as such, the challenge can only be ruined for someone who does not care about the challenge in the first place--someone who deliberately clicks a link knowing it contains a Project Euler solution.
  3. The answers are already out there. Don't believe me? Google "Project Euler answers". Moreover, Project Euler knows the answers are out there. As such, they have this disclaimer:

DISCLAIMER
The popularity of Project Euler has increased tremendously over the years since its inception through the concerted effort of numerous people.
Members have generally taken pride in showing their achievements. The obvious place to do so is the forum that is set up for each problem. However the increasing popularity has also been attracting people with a different agenda. With so many internet sites publishing answers for the PE problems instead of using the forum on this site, some people now seem to take pride in gathering and submitting those answers for whatever reason.
It is humanly impossible for Project Euler, or indeed any member, to reliably differentiate those people from members that have solved the problems under their own steam. The ranking lists on Project Euler should be interpreted for what they are: an indication of the number of correct answers submitted by the member in question and validated by our answer checker. Individual members themselves know best what they have achieved on their own. Laying too much stress on competition might spoil the fun of problem solving which is one of the purposes of Project Euler. Also, any claim from a member about his own achievement cannot be supported as trustworthy by Project Euler. If critical, other means from third parties would be required to verify such claims.
Providing quality problems for entertainment and educational purposes will continue to be the main goal of Project Euler, regardless of the intentions of a minority of the members.

They also have the following FAQ put up on their site:

I solved it by using a search engine, does that matter?
Making use of the internet to research a problem is to be encouraged as there could be hidden treasures of mathematics to be discovered beneath the surface of many of these problems. However, there is a fine line between researching ideas and using the answer you found on another website. If you photocopy a crossword solution then what have you achieved?

Thus, Project Euler is not an official competition and you won't get anything because of participating (except the "joy" of solving a problem by yourself and the "Eureka" moment). It does post some guidelines regarding the questions and how to discuss the answers. But if you post the solutions, explicitly marking what question it belongs to, you don't interfere with the spirit of the whole endeavor, as only people who are interested in "cheating" would open that link before solving a question. It's more of a moral code that you should stick with.

@mtbun mtbun mentioned this issue Oct 15, 2020
12 of 14 tasks complete
dhruvmanila pushed a commit that referenced this issue Oct 15, 2020
* Added solution for Project Euler problem 113. #2695

* Updated formatting and doctests. Reference: #3256
dhruvmanila pushed a commit that referenced this issue Oct 15, 2020
* Added solution for Project Euler problemm problem 173. #2695

* Added docstring

* Update formatting, doctest and annotations. Reference: #3256
@kugiyasan
Copy link

@kugiyasan kugiyasan commented Oct 15, 2020

image

@dhruvmanila dhruvmanila reopened this Oct 16, 2020
@Takosaga Takosaga mentioned this issue Oct 16, 2020
11 of 14 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

You can’t perform that action at this time.
X Tutup