# HP 50g User Manual Page 193

Graphing calculator.

operating on them. You can also convert any number into a ring number by
using the function EXPANDMOD. For example,
The modular inverse of a number
Let a number k belong to a finite arithmetic ring of modulus n, then the modular
inverse of k, i.e., 1/k (mod n), is a number j, such that j k
modular inverse of a number can be obtained by using the function INVMOD
in the MODULO sub-menu of the ARITHMETIC menu. For example, in modulus
12 arithmetic:
1/6 (mod 12) does not exist.
1/7
-5 (mod 12)
1/11
-1 (mod 12)
The MOD operator
The MOD operator is used to obtain the ring number of a given modulus
corresponding to a given integer number. On paper this operation is written
as m mod n = p, and is read as "m modulo n is equal to p". For example, to
calculate 15 mod 8, enter:
ALG mode:
RPN mode:
The result is 7, i.e., 15 mod 8 = 7. Try the following exercises:
18 mod 11 = 7
23 mod 17 = 6
One practical application of the MOD function for programming purposes is to
determine when an integer number is odd or even, since n mod 2 = 0, if n is
even, and n mode 2 = 1, if n is odd. It can also be used to determine when an
integer m is a multiple of another integer n, for if that is the case m mod n = 0.
EXPANDMOD(125)
EXPANDMOD(17)
EXPANDMOD(6)
15 MOD 8`
15`8` MOD
23 mod 2 =1
34 mod 6 = 4
5 (mod 12)
5 (mod 12)
6 (mod 12)
1/5
5 (mod 12)
1/3 (mod 12) does not exist.
40 mod 13 = 1
1 (mod n). The
Page 5-16