sorry, possibly too much info. was: Re: How can I speed up a script that iterates over a large range (600 billion)?

John Salerno johnjsal at gmail.com
Tue Jun 21 17:09:46 EDT 2011


On Jun 21, 3:22 pm, Irmen de Jong <ir... at -NOSPAM-xs4all.nl> wrote:
> On 21-06-11 22:10, Irmen de Jong wrote:
> [stuff]
>
> I didn't read the last paragraph of John's message until just now, and
> now realize that what I wrote is likely way too much information for
> what he asked.
> I'm sorry. Next time I'll read everything until and including the last
> full stop.
>
> Irmen

Don't worry, I was still unclear about what to do after reading all
the responses, even yours! But one thing that made me feel better was
that I wasn't having a Python problem as much as a *math* problem. I
changed my get_factors function to only go as far as the square root
of the number in question, and that yielded an answer immediately. :)

However, even after reading the Wikipedia page about prime numbers and
trial division, I'm still a little unclear as to why the square root
of the number is the upper bound of the range you need to check.



More information about the Python-list mailing list