Posted on September 17, 2007 by Steve
It is positively cheering to see that tens of thousands of man-hours (and undoubtedly some number of woman-hours) are being invested in
Project Euler. I have solved
five of the easiest problems so far, and am pleased to report that all of my programs run in less than the minute said to be sufficient.
Writing the programs is another matter; I didn't expect to find so much challenge and subtlety in writing a simple prime number validator.
I am using this as an exercise to learn some Python in addition to sharpening my number theory; other people take a more
traditional approach.
Comments
At the risk of seeming derivative, I chose to emulate your use of PE as a python training exercise. I was (only) moderately surprised that my first stab at problem 1 got the right answer on the first swing. Lessons learned in this exercise:
*Python does not have the ++ operator.
*Significant whitespace is the most moronic concept ever.
------------------
I noticed that one has to be logged in to see your
profile.
The first time I needed to increment something, I used "+= 1" then I thought that looked lame so I changed it to "++". Then I changed it back.
I feel a little guilty about #5. My "program" was a nineteen-line comment and then a "print" statement with the answer. It seems far more tedious to write an algorithm for the general case.
PE?
------------------
Excellent idea, Steve! Now how about showing us some
code?------------------
Drat -- how about some normal HTML in this blasted thing?!?! And a preview function for comments?
This is what I was trying to link to.
------------------
I have set up some web space on fiat to share and compare code. I couldn't find a good, simple content management system to arrange the files, so I just went low-tech:
http://www.fiatjustitia.net/Project_Euler/ contains subdirectories rwhunley and wasoxygen, each of which will contain files with our respective solutions. Anyone else who wants to participate, if you post your PE username here I'll create space for you as well.
The file names will have the format problemXXX_[ANSWER].txt, where XXX is the three digit problem number (i.e. with leading zeroes), and [ANSWER] is the numeric answer.
E.g. if the answer to problem 1 is 1111, my solution would be at
http://www.fiatjustitia.net/Project_Euler/rwhunley/problem001_1111.txt.
I was tempted to go back and edit some of my early floundering, but leaving it in will have definite entertainment value.
------------------
I am on PE as dionysus. Can I join in the fun? I'm way behind on the pace of the solutions, but hey, at least they are in Ruby :)
Cheers,
T.
------------------
Great - more the merrier. I set up an ftp account with uid dionysus@fiatjustitia.net (my hosting company's ftp account setup is quirky - you'll need to use that whole string, including the @fiatjustitia.net, as the user ID). I'll send the password to the hecat guy to forward to you.
------------------
*Python does not have the ++ operator.
*Significant whitespace is the most moronic concept ever.
------------------