failed attempts to intercept copy command when the cursor is in the empty text field...
[LeanCalc.git] / help / pmod
1 NAME
2     pmod - integral power of an integer modulo a specified integer
3
4 SYNOPSIS
5     pmod(x, n, md)
6
7 TYPES
8     x           integer
9     n           nonnegative integer
10     md          integer
11
12     return      integer
13
14 DESCRIPTION
15     pmod(x, n, md) returns the integer value of the canonical residue
16     of x^n modulo md, where the set of canonical residues is determined
17     by md and bits 0, 2, and 4 of config("mod") (other bits are ignored).
18
19     If md is zero, the value is simply x^n.
20
21     For nonzero md, the canonical residues v modulo md are as follows:
22
23                 config("mod")     md > 0              md < 0
24
25                     0           0 < v < md         md < v < 0
26                     1         -md < v < 0           0 < v < -md
27                     4           0 < v < md          0 < v < -md
28                     5         -md < v < 0          md < v < 0
29                    16       -md/2 < v <= md/2   md/2 <= v < -md/2
30                    17      -md/2 <= v < md/2     md/2 < v <= -md/2
31                    20       -md/2 < v <= md/2    md/2 < v <= -md/2
32                    21      -md/2 <= v < md/2    md/2 <= v < -md/2
33
34 EXAMPLE
35     > c = config("mod",0)
36     > print pmod(2,3,10), pmod(2,5,10), pmod(2,3,-10), pod(2,5,-10)
37     8 2 -2 -8
38
39     > c = config("mod",16)
40     > print pmod(2,3,10), pmod(2,5,10), pmod(2,3,-10), pmod(2,5,-10)
41     -2 2 -2 2
42
43 LIMITS
44     none
45
46 LINK LIBRARY
47     NUMBER *qpowermod(NUMBER *x, NUMBER *n, NUMBER *md)
48
49 SEE ALSO
50     mod, minv
51