HP 50g User Manual Page 191

Graphing calculator.

Notice that, whenever a result in the right-hand side of the "congruence" symbol
produces a result that is larger than the modulo (in this case, n = 6), you can
always subtract a multiple of the modulo from that result and simplify it to a
number smaller than the modulo. Thus, the results in the first case 8 (mod 6)
simplifies to 2 (mod 6), and the result of the third case, 15 (mod 6) simplifies to
3 (mod 6). Confusing? Well, not if you let the calculator handle those
operations. Thus, read the following section to understand how finite arithmetic
rings are operated upon in your calculator.
Finite arithmetic rings in the calculator
All along we have defined our finite arithmetic operation so that the results are
always positive. The modular arithmetic system in the calculator is set so that
the ring of modulus n includes the numbers -n/2+1, ...,-1, 0, 1,...,n/2-1, n/2,
if n is even, and –(n-1)/2, -(n-3)/2,...,-1,0,1,...,(n-3)/2, (n-1)/2, if n is odd.
For example, for n = 8 (even), the finite arithmetic ring in the calculator includes
the numbers: (-3,-2,-1,0,1,3,4), while for n = 7 (odd), the corresponding
calculator's finite arithmetic ring is given by (-3,-2,-1,0,1,2,3).
Modular arithmetic in the calculator
To launch the modular arithmetic menu in the calculator select the MODULO
includes functions: ADDTMOD, DIVMOD, DIV2MOD, EXPANDMOD,
FACTORMOD, GCDMOD, INVMOD, MOD, MODSTO, MULTMOD,
POWMOD, and SUBTMOD. Brief descriptions of these functions were provided
in an earlier section. Next we present some applications of these functions.
Setting the modulus (or MODULO)
The calculator contains a variable called MODULO that is placed in the
{HOME CASDIR} directory and will store the magnitude of the modulus to be
used in modular arithmetic.
The default value of MODULO is 13. To change the value of MODULO, you
can either store the new value directly in the variable MODULO in the sub-
directory {HOME CASDIR} Alternatively, you can store a new MODULO value
by using function MODSTO.
Modular arithmetic operations with numbers
To add, subtract, multiply, divide, and raise to a power using modular
arithmetic you will use the functions ADDTMOD, SUBTMOD, MULTMOD,
DIV2MOD and DIVMOD (for division), and POWMOD. In RPN mode you
need to enter the two numbers to operate upon, separated by an [ENTER] or an
Page 5-14  