Pari / GP异常/中断循环

时间:2013-12-01 16:15:23

标签: exception exception-handling elliptic-curve pari pari-gp

ellpow(E,P,m)将始终抛出异常:

*** ellpow: impossible inverse modulo: Mod(x, y).
***   Break loop: type 'break' to go back to GP

其中x和y是整数。

我想捕获值x,而不是为了使用它而完成程序 后面。

代码的片段是:

trap(invmoder,
    x,
    ellpow(E, P, m)
), n);

整个计划是:

ellcurv(n) = {
    local(B, a1, a2, a3, a4, a6, b, E, P, m, x);

    B = 20;

    a4 = Mod(random(n), n);
    b = 4*a4^3 + 27;
    b = 1/b;

    a1 = a2 = a3 = Mod(0, n);
    a6 = Mod(1, n);

    E = ellinit([a1, a2, a3, a4, a6]);
    P = [0,1];

    ellisoncurve(E, P);
    m = 1;
    for(i = 1, B,
        m = lcm(m, i));
    print(m);

    x = gcd(
        trap(,
            ellpow(E, P, m),
            ellpow(E, P, m)
        ), n);

}

0 个答案:

没有答案