示例#1
0
def factor(n):

    pari_light_interface.pari_init(100000000, 0)

    _n = pari_light_interface.pari_gp_read_str(str(n))

    _A = pari_light_interface.pari_Z_factor(_n)
    _P = pari_light_interface.pari_gel(_A, 1)
    _M = pari_light_interface.pari_gel(_A, 2)
    l = pari_light_interface.pari_lg(_P)

    f = []
    for i in range(1, l):
        _p = int(pari_light_interface.pari_gel(_P, i))
        p = int(pari_light_interface.pari_GENtostr(_p))
        _m = int(pari_light_interface.pari_gel(_M, i))
        m = int(pari_light_interface.pari_GENtostr(_m))
        if f and len(f) > 0:
            assert (
                p > f[-1][0]
            )  # if this fails, add some code that makes sure f is sorted
        f.append([p, m])

    pari_light_interface.pari_close()

    return f
def pari_cfg_datadir():

    pari_light_interface.pari_init(100000000, 0)

    _s = pari_light_interface.pari_sd_datadir()
    s = str(pari_light_interface.pari_GENtostr(_s).decode('utf-8'))[1:-1]
    
    pari_light_interface.pari_close()

    return s
示例#3
0
def pari_cfg_datadir():

    pari_light_interface.pari_init(100000000, 0)

    _s = pari_light_interface.pari_sd_datadir()
    s = str(pari_light_interface.pari_GENtostr(_s).decode('utf-8'))[1:-1]

    pari_light_interface.pari_close()

    return s
def sea_weierstrass(a, b, p, s=0):

    pari_light_interface.pari_init(100000000, 0)

    _a = pari_light_interface.pari_gp_read_str(str(a))
    _b = pari_light_interface.pari_gp_read_str(str(b))
    _p = pari_light_interface.pari_gp_read_str(str(p))

    _t = pari_light_interface.pari_Fp_ellcard_SEA(_a, _b, _p, s)
    t  = pari_light_interface.pari_GENtostr(_t)
    
    pari_light_interface.pari_close()
    
    return int(t)
示例#5
0
def sea_weierstrass(a, b, p, s=0):

    pari_light_interface.pari_init(100000000, 0)

    _a = pari_light_interface.pari_gp_read_str(str(a))
    _b = pari_light_interface.pari_gp_read_str(str(b))
    _p = pari_light_interface.pari_gp_read_str(str(p))

    _t = pari_light_interface.pari_Fp_ellcard_SEA(_a, _b, _p, s)
    t = pari_light_interface.pari_GENtostr(_t)

    pari_light_interface.pari_close()

    return int(t)
def pari_version():

    pari_light_interface.pari_init(100000000, 0)

    _v = pari_light_interface.pari_version()
    _x = pari_light_interface.pari_gel(_v, 1)
    _y = pari_light_interface.pari_gel(_v, 2)
    _z = pari_light_interface.pari_gel(_v, 3)
    x = int(pari_light_interface.pari_GENtostr(_x))
    y = int(pari_light_interface.pari_GENtostr(_y))
    z = int(pari_light_interface.pari_GENtostr(_z))

    pari_light_interface.pari_close()
    
    return str("%d.%d.%d"%(x,y,z))
示例#7
0
def pari_version():

    pari_light_interface.pari_init(100000000, 0)

    _v = pari_light_interface.pari_version()
    _x = pari_light_interface.pari_gel(_v, 1)
    _y = pari_light_interface.pari_gel(_v, 2)
    _z = pari_light_interface.pari_gel(_v, 3)
    x = int(pari_light_interface.pari_GENtostr(_x))
    y = int(pari_light_interface.pari_GENtostr(_y))
    z = int(pari_light_interface.pari_GENtostr(_z))

    pari_light_interface.pari_close()

    return str("%d.%d.%d" % (x, y, z))
def factor(n):

    pari_light_interface.pari_init(100000000, 0)

    _n = pari_light_interface.pari_gp_read_str(str(n))

    _A = pari_light_interface.pari_Z_factor(_n)
    _P = pari_light_interface.pari_gel(_A, 1)
    _M = pari_light_interface.pari_gel(_A, 2)
    l = pari_light_interface.pari_lg(_P)
    
    f = []
    for i in range(1, l):
        _p = int(pari_light_interface.pari_gel(_P, i))
        p = int(pari_light_interface.pari_GENtostr(_p))
        _m = int(pari_light_interface.pari_gel(_M, i))
        m = int(pari_light_interface.pari_GENtostr(_m))
        if f and len(f) > 0:
            assert(p > f[-1][0]) # if this fails, add some code that makes sure f is sorted
        f.append([p, m])

    pari_light_interface.pari_close()
    
    return f