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_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 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