On Thu, Jul 15, 2010 at 10:36 AM, troublion <marusia.reboll...@gmail.com> wrote:
> hello,
>
> within a procedure I need to factorize an integer R_c depending on a
> parameter c which I can change if I want. But this integer can be very
> big (like 170 digits or more...) so sage could not factorize it. I
> would like to say to sage something like "if you can, factorize it,
> else look at R_{c+1}".
> Is it possible? How?
> thank you very much in advance,

My new @fork decorator is perfect for this, which you get from
http://trac.sagemath.org/sage_trac/ticket/9501, or wait for sage-4.5.1
(in 2-3 weeks).

Code:


@fork(timeout=1)
def fac1(n):
    return factor(n)



Usage:

sage: fac1(2903482093840982)
2 * 15907 * 26203 * 3482971
sage: fac1(2^97+1)
3 * 971 * 1553 * 31817 * 1100876018364883721
sage: fac1(2^997+1)
Killing subprocess 94648 with input
((1339385758982834151185531311325002263201756014631917009304687985462938813906170153116497973519619822659493341146941433531483931607115392554498072196837321850491820971853028873177634325632796392734744272769130809372947742658424845944895692993259632864321399559710817770957553728956578048354650708508673,),
{}) which took too long
'NO DATA (timed out)'


-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to