Hi,
On this topic, Sebastian Pancratz and I wrote an optimized
implementation of trial division to find the smallest factor of an
integer:
http://trac.sagemath.org/sage_trac/ticket/9537
This may be in sage-4.5.2.
-- William
On Mon, Jul 19, 2010 at 9:16 PM, Rolandb <[email protected]> wrote:
> Hi,
>
> I use ZZ(ss).factor(proof=False,limit=10^5).
>
> By changing 'limit' you limit the search.
>
> 2^26 * 3^30 * 5^15 * 7^5 * 13^5 * 23^2 * 29 * 37 * 967 *
> 100231435706561580153005984524922236635721822683010490144527758096287118\
> 468921220756478157058125901560872523532972896397
>
> This can be combined with a timer.
>
> Roland
>
> On 19 jul, 17:51, chris wuthrich <[email protected]> wrote:
>> > > A related question: is it possible to catch an exception if there is a
>> > > time out?
>>
>> I think there should be. The timeout process should raise an exception
>> which can be catch. Right now, one can catch that it sends back a
>> string 'NO DATA (timed out)' rather than a result. So the following
>> should do. But that is not the way it should be IMHO.
>>
>> @fork(timeout=1)
>> def mon_factor(n):
>> return factor(n)
>>
>> for m in [randint(10,100) for i in [1..10]]:
>> N = 10^m +127
>> ff = mon_factor(N)
>> if type(ff) != type('a'):
>> print "success : %s"%ff
>> else:
>> print "no success : %s"%ff
>>
>> Chris.
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org