Speeding up a script -- looking for ideas

Terry Reedy tjreedy at udel.edu
Sun Oct 20 10:43:44 EDT 2002


"Richard Bow" <donkan7 at yahoo.com> wrote in message
news:Xns92ADE4723B46donkansevenyahoocom at 130.133.1.4...
> I'm hoping to get some hints for significantly speeding up the below
> script.

First, precalculate a list of cubes instead of cubing over and over.
Next, calculate sums within particular range (small enough to not
oerflow memory).
Store as dict(sum) = (a,b) or list.append( (sum, a, b)).
If dict, easy to spot duplicate sums.
If list, sort and scan for dups.

Terry J. Reedy





More information about the Python-list mailing list