Esempio n. 1
0
    /* quick and dirty check for common factor with n */
    public bool cfactor(int s)
    {
        int r, n = length;
        int g;

        FF x = new FF(n);
        FF y = new FF(n);

        y.set(s);
        x.copy(this);
        x.norm();

        do
        {
            x.sub(y);
            x.norm();
            while (!x.iszilch() && x.parity() == 0)
            {
                x.shr();
            }
        } while (comp(x, y) > 0);

        g = (int)x.v[0].get(0);
        r = igcd(s, g);
        if (r > 1)
        {
            return(true);
        }
        return(false);
    }