1 |
On Sun, 2006-02-12 at 18:22 +0100, Michael Hanselmann wrote: |
2 |
> Hello |
3 |
> |
4 |
> For an ebuild I'm working on, I need a function to test wether a number |
5 |
> is a prime number. For that, I wrote an Eclass you find attached to this |
6 |
> e-mail. Can this be commited? |
7 |
In what range do you need the random numbers? |
8 |
Your implementation uses a naive test that runs in O(n), so any large |
9 |
input will cause it to take excessively long: |
10 |
|
11 |
time primes 100 1000 |
12 |
real 0m0.160s |
13 |
|
14 |
time primes 10000 10100 |
15 |
real 0m7.309s |
16 |
|
17 |
And I guess a 32-bit prime is out of reach :-) |
18 |
-- |
19 |
Stand still, and let the rest of the universe move |