Subject: | suggest prime factors |
Date: | Sat, 24 Dec 2011 08:03:34 +1100 |
To: | bug-Math-Factor-XS [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
As an idea for a feature it could be good to have a prime_factors() or
some such name function which returned a list of just prime factors.
Eg.
prime_factors(90) => (2,3,3,5)
In some code I made lately, in one place I wanted them with
multiplicity, like this "3, 3", but then in another place I think I want
just the distinct primes, without being interested in what power of each
there might be.
Returning repetitions has the attraction of making product of the
returned list equals the input n. Perhaps another func or an option to
return distinct prime factors only.