Nick Hobson on Sat, 02 Dec 2006 00:07:15 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Two factor questions |
Thanks Bill. NickOn Sat, 25 Nov 2006 21:54:08 -0000, Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> wrote:
On Sat, Nov 25, 2006 at 09:20:20PM -0000, Nick Hobson wrote:Hi, I have a couple of questions about the factor function, as applied to integers. 1) Does it sort the results by prime (i.e., first column)? All the results I've seen have been sorted, but I notice the manual doesn't specify this behavior. (Unless I'm missing something.)Yes. (beware that for negative numbers the first line is [-1,1]).2) Is it possible to request only the smallest prime factor, rather than acomplete factorization?Not really. The only algorithm available in PARI that can _prove_ a factor is the smallest is trial division, and there are no toggle in place to stoptrial division at the first hit. However you can easily implement that yourself using the prime number table. On the other hand, if you want a small prime factor without a proof it is the smallest, then it is possible at least in library mode. Cheers, Bill.