A simple sieve in Phobos?

Russel Winder russel at winder.org.uk
Mon Mar 31 09:53:11 PDT 2014


On Mon, 2014-03-31 at 00:55 +0000, bearophile wrote:
> safety0ff:
> 
> > I.E. Are there non-toy uses to support inclusion?
> 
> I have several non-toy uses for the GCD, binomial, and the 
> permutations/combinations/pairwise ranges.

Finance, bioinformatics, signal processing, are some of the areas I know
of where all this sort of stuff is useful. Python, Mathematica, Julia
all provide these either fast using hardware numbers or to arbitrary
accuracy using software numbers.

> The other little discrete numerical functions like the integer 
> square root, etc, are useful sufficiently often.
> 
> The other two (isPrime and a sieve) are less practical, so their 
> inclusion is more debatable. Sometimes you want some small primes 
> for hashing, or in the unittests of a Rational type, and few 
> other situations. But D is for mathematics usage too. Given the 
> commonality of prime numbers in discrete mathematics (example: if 
> you want to study certain graphs), I think such two/three 
> functions/generators are acceptable, if they aren't too much 
> complex.

Or for force cracking of encodings? ;-)

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list