{{{id=1| R.=GF(4,'a')[] C=Curve(x^2+y^2+z^2+x*y+y*z+x*z) /// }}} {{{id=2| C.rational_points() /// [(0 : a : 1), (0 : a + 1 : 1), (1 : 1 : 1), (a : 0 : 1), (a : 1 : 0), (a : a + 1 : 1), (a + 1 : 0 : 1), (a + 1 : 1 : 0), (a + 1 : a : 1)] }}} {{{id=3| C.irreducible_components() /// [ Closed subscheme of Projective Space of dimension 2 over Finite Field in a of size 2^2 defined by: x + (a)*y + (a + 1)*z, Closed subscheme of Projective Space of dimension 2 over Finite Field in a of size 2^2 defined by: x + (a + 1)*y + (a)*z ] }}} {{{id=15| R.=QQ[] f=y^2*z-x^3-x^2*z-x*z^2-z^3 print f print f.subs(x=x-z/3) g=f.subs(x=(x-3*z),z=9*z,y=y/3) print g /// -x^3 - x^2*z + y^2*z - x*z^2 - z^3 -x^3 + y^2*z - 2/3*x*z^2 - 20/27*z^3 -x^3 - x^2*z + y^2*z - x*z^2 - z^3 -x^3 + y^2*z - 54*x*z^2 - 540*z^3 }}} {{{id=4| R=Integers(7) /// }}} {{{id=5| x=R(2) print x, x^2 /// 2 4 }}} {{{id=6| x.is_square() /// True }}} {{{id=7| a=x.sqrt() /// }}} {{{id=8| print a, 100*a /// 3 6 }}} {{{id=9| print a.lift(), 100*a.lift() /// 3 300 }}} {{{id=12| n=random_prime(10^30)*random_prime(10^30) print n R=Integers(n) time R.random_element().is_square() /// 259468041008459855294387276057534250856171095921607899243851 False Time: CPU 14.05 s, Wall: 14.10 s }}} {{{id=13| p=random_prime(10^100) print p R=Integers(p) time R.random_element().is_square() /// 7639348727956502630901178142032701015745738842489735984849060064941196687282154494289308481814891337 False Time: CPU 0.11 s, Wall: 0.11 s }}} {{{id=19| next_prime(999312434) /// 999312443 }}} {{{id=20| /// }}}