[Haskell-cafe] factorising to prime numbers

2007-02-09 Thread Dougal Stanton
Hi folks, I recently read in my copy of Concrete Mathematics the relationship between prime factors powers and lcm/gcd functions. So I decided to reimplement gcd and lcm the long way, for no other reason than because I could. If you look at the definition of 'powers' you'll note it's infinite.

Re: [Haskell-cafe] factorising to prime numbers

2007-02-09 Thread kahl
If you look at the definition of 'powers' you'll note it's infinite. So there's no easy way to take the product of this list, if I don't know how many items to take from it. So you need finite lists. -- how many of the prime p are in the unique factorisation -- of the integer n?

Re: [Haskell-cafe] factorising to prime numbers

2007-02-09 Thread Robert Dockins
On Feb 9, 2007, at 9:20 AM, Dougal Stanton wrote: Hi folks, I recently read in my copy of Concrete Mathematics the relationship between prime factors powers and lcm/gcd functions. So I decided to reimplement gcd and lcm the long way, for no other reason than because I could. If you look at

Re: [Haskell-cafe] factorising to prime numbers

2007-02-09 Thread Mikael Johansson
On Fri, 9 Feb 2007, Dougal Stanton wrote: Hi folks, I recently read in my copy of Concrete Mathematics the relationship between prime factors powers and lcm/gcd functions. So I decided to reimplement gcd and lcm the long way, for no other reason than because I could. If you look at the