Speeding up a script -- looking for ideas

Terry Reedy tjreedy at udel.edu
Sun Oct 20 16:43:44 CEST 2002

"Richard Bow" <donkan7 at yahoo.com> wrote in message
news:Xns92ADE4723B46donkansevenyahoocom at
> 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