Max Alekseyev on Fri, 26 Apr 2013 18:31:39 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Trying to factor a number a bit but not hanging the program for hours |
Please see attached script. Regards, Max On Fri, Apr 26, 2013 at 9:57 AM, Richard in Reading <richard_in_reading@yahoo.co.uk> wrote: > As part of a pari program I'm trying to factor certain large numbers but then give up if a factorization isn't easily achievable. I've been using factorint(n,9) with the expectation that it will always complete reasonably quickly. > > However > > factorint(19841096725703655581869366691520038810629264428011560812788963464047306742065927607422529,9) > > runs for hours whereas > > factorint( 450448646198249 * 7187991967803917, 9) > [3237821250781162225771540741333 1] > > returns straight away even though I'm supplying a composite. > Note that factor() returns the above factors in about 0.2 of a second. > > It would be nice to have a decent factoring function which spends a certain amount of time trying to factor a number and then gives up. I seem to remember seeing a script on the web which could do it in pari using the default factoring function but using some function in combination with trap to interrupt its execution after a time. > Can anyone help? > > Cheers! > > Richard > > PS Thanks to Dirk Laurie for solving my sqrt complaint! >
Attachment:
timefact.gp
Description: Binary data