Boost logo

Boost :

From: Lucas Galfaso (lgalfaso_at_[hidden])
Date: 2003-09-18 00:06:12


If such a poor algorithm is implemented, is it really that usefull the
detection of primes at compile time (and on such a small scale) that is
worth the compiler to work that hard?

Lucas/

"Stephen Nutt" <snutt_at_[hidden]> wrote in message
news:001501c37d6c$3f79e940$0d00a8c0_at_dualamd...
> Lucas,
>
> If only prime number detection were that easy :) I do it the hard way,
> divide the suspected prime by all numbers >=2 and <= the square root of
the
> candidate. I skip even numbers, but found it was easier to use all odd
> numbers than to try and determine if the divisor were prime.
>
> So to compile is_prime<450000007> I force the compiler to do well over
> 10,000 divisions before it comes back and says "you've got a prime on your
> hands!"
>
> Steve
>
> ----- Original Message -----
> From: "Lucas Galfaso" <lgalfaso_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Wednesday, September 17, 2003 8:58 AM
> Subject: [boost] Re: Compile time prime numbers, powers and roots
>
>
> > how you test if a number is prime. As you might know, verifying that
> > m for a specific s, is not enough.
> >
> > Lucas/
> >
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk