Even if a program is going to be run just once or a problem is already solved there is satisfaction in doing it well for oneself. The pursuit of Truth and Beauty makes life worth living. Better than watching the Super Bowl, for instance.
----- Original Message ----- From: Devon McCormick <[EMAIL PROTECTED]> Date: Saturday, February 3, 2007 11:22 am Subject: Re: [Jprogramming] Collatz Problem again > 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 > about1350 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
