<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>integers modulo a prime</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_finite_spfields.html">next</a> | <a href="_basic_springs_spof_spnumbers.html">previous</a> | <a href="_finite_spfields.html">forward</a> | <a href="_basic_springs_spof_spnumbers.html">backward</a> | <a href="_rings.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="_rings.html" title="">rings</a> > <a href="_integers_spmodulo_spa_spprime.html" title="">integers modulo a prime</a></div> <hr/> <div><h1>integers modulo a prime</h1> <div>Create the ring of integers modulo a prime number <tt>p</tt> as follows.<table class="examples"><tr><td><pre>i1 : R = ZZ/101 o1 = R o1 : QuotientRing</pre> </td></tr> </table> We can create elements of the ring as follows.<table class="examples"><tr><td><pre>i2 : 9_R o2 = 9 o2 : R</pre> </td></tr> <tr><td><pre>i3 : 103_R o3 = 2 o3 : R</pre> </td></tr> </table> The usual arithmetic operations are available.<table class="examples"><tr><td><pre>i4 : 9_R * 11_R o4 = -2 o4 : R</pre> </td></tr> <tr><td><pre>i5 : 9_R ^ 11 o5 = 49 o5 : R</pre> </td></tr> <tr><td><pre>i6 : 9_R * 11_R == -2_R o6 = true</pre> </td></tr> </table> Find the inverse of an integer modulo a prime as follows.<table class="examples"><tr><td><pre>i7 : 17_R^-1 o7 = 6 o7 : R</pre> </td></tr> </table> To view this element as an element of <tt>ZZ</tt> use the <a href="_lift.html" title="lift to another ring">lift</a> command.<table class="examples"><tr><td><pre>i8 : lift (17_R^-1, ZZ) o8 = 6</pre> </td></tr> </table> </div> </div> </body> </html>