Macaulay2 » Documentation
Packages » Macaulay2Doc > rings > integers modulo a prime
next | previous | forward | backward | up | index | toc

integers modulo a prime

Create the ring of integers modulo a prime number p as follows.
i1 : R = ZZ/101

o1 = R

o1 : QuotientRing
We can create elements of the ring as follows.
i2 : 9_R

o2 = 9

o2 : R
i3 : 103_R

o3 = 2

o3 : R
The usual arithmetic operations are available.
i4 : 9_R * 11_R

o4 = -2

o4 : R
i5 : 9_R ^ 11

o5 = 49

o5 : R
i6 : 9_R * 11_R == -2_R

o6 = true
Find the inverse of an integer modulo a prime as follows.
i7 : 17_R^-1

o7 = 6

o7 : R
To view this element as an element of ZZ use the lift command.
i8 : lift (17_R^-1, ZZ)

o8 = 6