Thank you Devon for your advice. Ruby on Rails which receives a lot of spotlight among web developers thesedays has a philosophy : programmer's time is the most expensive. With RoR you can develop usual web application in one tenth of common developing time, while the performance may be five to ten times slower. They try to reduce the programmer's time at the cost of longer computing time; they say you should solve most scalability problems with more expensive hardwares. I agreed with them.
I fully appreciate your advice, but still believes there are values at investing more time improving the solution, which already does the job required. June 2007/2/4, Devon McCormick <[EMAIL PROTECTED]>:
June - how many times do you plan to solve the problem or do you plan to extend the search? I'm asking because I just wrote "collatz" myself for the projectEuler math challenge. My version, which I wrote in less than 5 minutes, took about 1350 seconds to complete for the first million integers. Obviously, Roger's version is far faster. However, I may never run this code again. I looked at one of the discussion groups on the math challenge site and, typically, much of the talk was about shaving seconds off an implementation of code to solve one of the problems. I still fail to grasp the economics of spending hours of one's own, irreplaceable time to save seconds of processing time, especially for one-shot solutions and especially since I can do other things in the 1300 seconds I "waste" by not running faster code. Apologies to long-time readers of this forum for this re-iteration of my standard rant, number one on the list, but it continues to be relevant. Just to point out the benefits of coding quickly and inefficiently, in the few days since I got interested in this math challenge, I've gotten my ranking up to around 380 out of 2089, so I've passed about 1700 people. Not to brag: I owe it to J and a little of it to advance peeks at some of the problems people have asked about on the forum. I probably should really be embarrassed that I'm gaining on people in a race where most of them are crawling, wearing boxes on their heads and dragging chains. So, I'm unwilling to spend more than a few minutes to improve on a solution, especially one that Roger wrote. However, his essay on the solution is worthwhile, especially for the notion of caching results, as this has general applicability and may be a time-saver in the future. Good luck, Devon On 2/3/07, June Kim <[EMAIL PROTECTED]> wrote: > > Have a look at this problem: > > http://www.programming-challenges.com/pg.php?page=downloadproblem&probid=110101&format=html > > In short, you need to calculate the maximum cycle length in a given range. > > Roger wrote an essay which is related to this problem. > http://www.jsoftware.com/jwiki/Essays/Collatz_Conjecture > > Suppose we want to calculate the maximum cycle length of collatz > sequences for 1, ..., 1e6. > > It would be defined, using Roger's definition, as >./ cn 1e6 > > It currently takes around 40 secs on the computer I'm using. Could you > improve its efficiency? > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm