

Solving Project Euler problems - btilly
http://bentilly.blogspot.com/2010/01/solving-project-euler-problems.html

======
semmons
Project Euler is a great tool to learn a new programming language. I used it,
along with 'Programming Clojure' to learn Clojure. You can see all my problems
on GitHub. <http://github.com/semmons99/clojure-euler>

~~~
zck
I can't decide whether to put my solutions up. They're in Arc, so they might
be useful for people learning the language, as there aren't many Arc-specific
programs out there.

~~~
timwiseman
So why are you hesitating? If your programming is good you will only help
other people and may get some useful exposure in the community in the process.

If your programming is bad, (hypothetically) you will likely get people to
give you good pointers so that you are better next time.

Either way, I see no reason not to, and the fact you are using Arc just
increases the importance of helping people to follow along behind you.

~~~
btilly
One good reason to hesitate is that Project Euler is supposed to be a set of
problems that people solve for themselves. Therefore the admins request that
people not post solutions, and occasionally will tweak parameters if certain
problems are too easy to find with a Google search.

It is a losing battle to be sure, but they put a lot of work into it and I
prefer it when people respect their request to not facilitate cheating.

~~~
timwiseman
People who are going through Project Euler to practice will never search for
those and would likely forget the fine details quickly, so having the answers
out there somewhere won't matter to them. People who want to cheat at Project
Euler already have plenty of ways (and besides, what would they gain? At least
from my minimal participication, it does not really look like a contest and
there are no prizes).

On the other hand, people who want to learn Arc might be very greatful to have
a good set of code out there.

~~~
yummyfajitas
_and besides, what would they gain?_

Some companies in the financial industry use PE problems for interviews.
People memorize brainteasers for these interviews, so I imagine people might
also want to memorize PE solutions.

------
extension
IMHO Project Euler teaches bad programming by asking you to solve specific
cases instead of general problems. I've found at least one problem where the
straightforward correct answer failed in the general case, and the generic
solution was significantly more complicated.

Edit: this one
[http://projecteuler.net/index.php?section=problems&id=13](http://projecteuler.net/index.php?section=problems&id=13)

~~~
btilly
I'm not sure what you mean by "straightforward correct answer".

I just used a big integer library, calculated the answer, and then took the
first 10 digits. That should work out fine in any reasonable general case that
you're likely to be thinking of.

~~~
extension
What I found in example solutions, and is indeed accepted by the site, is
truncating each number to 10 digits and then summing. You can do this with
just double-precision FP so it's likely to be the most common solution in
languages that don't have bignums baked in.

~~~
btilly
Ah, right.

There are also a number of problems where it is possible to narrow down the
answer fairly easily, then submit a limited number of guesses until you get
the right answer without having really shown that it is right.

But they try to limit how easy that is to do.

~~~
roundsquare
_There are also a number of problems where it is possible to narrow down the
answer fairly easily, then submit a limited number of guesses until you get
the right answer without having really shown that it is right._

To some degree, they need to rely on the users to care enough not to "cheat."
There is no way to completely avoid people doing things like this.

------
zck
#240 is pretty evil. I spent a lot of time trying thing that I thought would
work, but didn't. Well done creating it.

~~~
jacobolus
Why can’t you just figure out how many ways to sum 10 12-sided dice to 70, and
then for each solution, multiply that by the number of ways the other dice
could all be ≤ the smallest one (times changes in ordering). Seems like it'd
take no more than 20 or 30 minutes to code up.

~~~
huherto
Go ahead and try it out. I've only solved 87 problems, but I enjoyed it very
much. My experience was that many problems were very deceptive. At first you
think, it is really easy, and after awhile it becomes evident that the problem
is much harder than initially thought. I appreciated that every problem seems
to teach you something new, even if the problem seems very similar to a
previous one, there is usually a twist.

