Double factorial and primorial
bodrato at mail.dm.unipi.it
bodrato at mail.dm.unipi.it
Wed Dec 21 13:16:04 CET 2011
Il Mer, 21 Dicembre 2011 10:56 am, Niels Möller ha scritto:
> The simplest and *general* interface I can come up with takes a range as
A range delimited by? two unsigned long?
To be *general* we should allow two mpzs... but it looks too hard to
implement.
> input, and a callback function. And then that callback function is
> invoked for each prime in the interval. Could perhaps also return the
And whenever the callback returns a non-zero, the loop is interrupted, so
that one can stop when the needed prime is found.
> number of primes in the interval, and allow a NULL callback.
If the loop can be interrupted, it is probably better to return the last
used prime (or zero if there are none in the range).
The prime counting function can have its own interface and its specialised
code: with a bitwise sieve, popcount is faster than some kind of loop.
--
http://bodrato.it/
More information about the gmp-devel
mailing list