beautypg.com

Finite arithmetic rings in the calculator – HP 48gII User Manual

Page 186

background image

Page 5-15

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
sub-menu within the ARITHMETIC menu („Þ). The available menu
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 [SPC] entry, and then press the corresponding modular arithmetic function.
For example, using a modulus of 12, try the following operations:

This manual is related to the following products: