# Project Euler Solutions

I was thinking that some of my python solutions to project Euler problems might be good candidates for code review - pretty short little programs that I've tried to write well, but would love to get input on. Is posting solutions to these problems discouraged? Should I just not mention that they're from that site?

As a note, all of this content is only available in the About page and only to registered users.

First, there's this:

There seems to be discussion threads for each problem, so why can't I access some of them?

You are only able to access a thread for a particular problem once you have solved it. Once you have access you will be able to see how other members have solved the problem, discuss methods, and share your insights.

And this:

Is there anywhere else we can discuss and meet other members?

Indeed there is! There is an alternative phpBB forum which has been set up to allow members to engage in general discussions, share ideas relating to problem solving and programming, make suggestions about the website, and ask for clarification on the wording of a particular problem. The link is given below, but please be aware that your account at this website has not been automatically transferred to the alternative forum and you will need to set up a separate account.

Forum Web Address: <redacted>

Also please note that your posts will be visible to all members and you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

These posts outline some guidelines on discussing problem solutions within the Project Euler website itself. But even the point which directly addresses sharing answers with users who have not come across the solution yet is merely a gentle request (though I am not completely familiar with their moderation guidelines and I am not sure what would happen if you posted a solution in the area that the second FAQ discusses)

Then there's this:

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.

And this does seem to be directly about posting solutions to websites other than Project Euler. But...

1. They've got no ownership over my solution. They can make a gentle request that, in the spirit of Project Euler, I not ruin the challenge for others, but that's all they can do--make a gentle request. In the end, the code is mine, and what I do with it is my decision.

2. The point of the rule is to prevent the challenge being ruined from others. If Project Euler questions 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.

Ultimately, it's important to remember that Project Euler is not a serious competition. It's a great site for finding interesting challenges. The fun (or knowledge) isn't in the answer, but in the path to solution. And there's even more fun (and knowledge) to be had when discussing the specifics of a solution.

Ultimately, from what I've seen of the Project Euler forums, it's a really, really bad venue for discussing code. It just doesn't compare to Stack Exchange style question-answer format.

So why can't CodeReview be that venue? And I'm fine with keeping the questions marked as best as possible.

I will also note...there are nearly 500 Project Euler problems. The mods and community can't be expected to have all of the problem statements memorized, and as such, isn't it better that we publicly allow the Project Euler questions yet explicitly state that it is a Project Euler solution into the title, rather than disallow them and risk other users sneaking the solutions in without mentioning Project Euler in the solution?

• Project Euler is about learning, I think I've learned more by reviewing Project Euler code than I would have if I would have solved them myself. – Simon Forsberg Aug 24 '14 at 23:11

Precedent says it's fine. There are already three Project Euler questions on this site and they were reasonably well received.

However you should mention in the title which problem the question is about, so Project Euler users who haven't solved that problem yet don't get spoiled.

Is posting solutions to these problems discouraged?

Probably not.

From the FAQ -

Code Review - Stack Exchange is for sharing code from projects you are working on for peer review. If you are looking for specific feedback about…

• Code correctness
• Best practices and design pattern usage in your code
• Application UI
• Security issues in a code snippet, etc.

I'd say that a Project Euler solution would probably fall under code correctness and best practices.

Should I just not mention that they're from that site?

You should definitely mention that they're from Project Euler. If I were you, I'd quote the whole problem (and expected answer) from Project Euler, post a link to it, and post the [already working] code.

The Project Euler site has a firm opinion on this – unfortunately this section of their FAQ is only visible when signed in:

### 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.

I think they ask you not to publish the solution anywhere.

• While they do ask that, they did not write the solution I came up with, and they do not have a copyright on it. – nhgrif Aug 24 '14 at 13:42
• @nhgrif: I think that the OP did not ask if it is a legal problem to post the solution. – miracle173 Aug 24 '14 at 13:48
• It's not just that they don't hold a copyright. They don't own my code in any way whatsoever. So not just from a legal standpoint, but from any standpoint, they really don't have any business telling me where and how I can post my code. – nhgrif Aug 24 '14 at 13:55
• @nhgrif: From "any standpoint" is wrong. Because it seems from their standpoint they want not the solutions to be posted. It think it does not make sense talking about "any standpoint" because it is rather unclear which standpoints are included in "any standpoints" – miracle173 Aug 24 '14 at 14:54
• From their standpoint they don't want me to post the solution, that is accurate. That doesn't mean, from their standpoint, they have any business in dictating whether or not the solution gets posted. They can politely request that it not be posted, which is what they've done. But they've made this request for a specific reason--to prevent spoiling the learning process for others. To cater to that aspect of the request, we require that Project Euler solutions are clearly marked as such. – nhgrif Aug 24 '14 at 14:57
• There is no such text on the page I see when I click that link. – rolfl Aug 24 '14 at 20:25
• @rolfl It seems that this text will only be displayed if you are logged in. – miracle173 Jan 29 '17 at 5:20
• @miracle173 - which may be true, but it contradicts your point - that the FAQ about copying is not even visible to most people, including me. It can't be directed at me if they won't even show me - so only people who are "members" are even considered when copying answers is concerned. How "firm" is their opinion if they won't even share it with me? – rolfl Jan 29 '17 at 5:46