in reply to Re: Perl Not Releasing Memory
in thread Perl Not Releasing Memory
There are faster ways to decide this problem, as well. I'm no mathematician, but your algorithm is dividing by all odd factors between 3 and sqrt(x); this can be improved by dividing by all *prime* factors between 3 and sqrt(x).
Since you're already finding all these numbers, just use dynamic programming-- when you find a prime, hash it for later reference. Then in your loop just go through the keys of your hash.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Perl Not Releasing Memory
by Limbic~Region (Chancellor) on Jul 02, 2003 at 14:45 UTC |