1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| d = inverse_mod(e,fn) prime_pi(n) divisors(n) number_of_divisors(n) factor(n) euler_phi(n) two_squares(n) three_squares(n) four_squares(n)
x.nth_root(n, truncate_mode=True) mod(x,p).nth_root(n)
def mod_nth_root(x, e, n): r, z = pari(f"r = sqrtn(Mod({x}, {n}), {e}, &z); [lift(r), lift(z)]") r, z = int(r), int(z) roots = [r] t = r while (t := (t*z) % n) != r: roots.append(t) return roots d,u,v=xgcd(20,30) print("d:{0} u:{1} v:{2}".format(d,u,v)) crt([2,3,2],[3,5,7]) print(euler_phi(x))
|