/usr/share/doc/cl-rsm-mod/rsm-mod.html is in cl-rsm-mod 1.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <head><title>rsm.mod</title>
<meta http-equiv="Expires" content="Jan 1 1990 00:00:00 GMT" />
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
<meta name="Copyright" content="R. Scott McIntire 2003 <rscottmcintire@users.sourceforge.net>" />
<meta name="description" content="Modular Arithmetic" />
<meta name="author" content="R. Scott McIntire" />
<meta name="keywords" content="modular, arithmetic, Lisp" />
<meta name="generator" content="LML2-1.4.1" />
<center><h1>Documentation for package rsm.mod</h1></center></head>
<body bgcolor="#C5C5C5"><hr color="lightred" style="height=10" /><p></p>
<table border="10" bordercolor="navyblue" align="center" cellspacing="15"><tr bgcolor="#A5A5A5"><td><h2>Author : R. Scott McIntire</h2>
<h2>Version: 1.2</h2>
<h2>Overview:</h2>
<pre>This package supports modular arithmetic.
<b style="color:darkblue">Export Summary:</b>
<b style="color:darkblue">
+:</b> Add numbers over Z mod n.<b style="color:darkblue">
*:</b> Multiply numbers over Z mod n.<b style="color:darkblue">
^:</b> Exponentiate over Z mod n.
<b style="color:darkblue">
euler-phi:</b> Return the Euler phi function of a number.<b style="color:darkblue">
factors :</b> Return the factors of a number.<b style="color:darkblue">
gcd-with-pair:</b> Gets the gcd of two numbers a and b returning also
the integer pair, (r s), such that r*a + s*b = gcd(a,b).<b style="color:darkblue">
has-inverse-p:</b> Does a number have in inverse in Z mod n?<b style="color:darkblue">
inverse :</b> Find the inverse (if it exists) in Z mod n.<b style="color:darkblue">
ppow :</b> Exponentiate over Z mod p where p is prime.
<b style="color:darkblue">
rational-approx:</b> Returns a simple rational approximation
within a given tolerance.<b style="color:darkblue">
solve-congruence-system:</b> Solve for x: x = a_i mod m_i; i in [1,N]
</pre>
</td></tr><tr bgcolor="#C5C5C5"></tr><tr bgcolor="#C5C5C5"><td>
<h2 style="color=darkblue">*<b style="color=blue">  (mod &rest args)</b></h2><pre>Multiply <em style="color:blue"><args></em> in Mod <em style="color:blue"><mod></em> arithmetic.<div style="color:darkgreen">
Example: (rsm.mod:* 3 2 5) </div>
1</pre>
<h2 style="color=darkblue">+<b style="color=blue">  (mod &rest args)</b></h2><pre>Add <em style="color:blue"><args></em> in Mod <em style="color:blue"><mod></em> arithmetic.<div style="color:darkgreen">
Example: (rsm.mod:+ 3 3 5) </div>
2</pre>
<h2 style="color=darkblue">^<b style="color=blue">  (b n mod &key (e-phi 0))</b></h2><pre>Raise <em style="color:blue"><b></em> to the <em style="color:blue"><n></em>th power mod <em style="color:blue"><mod></em> by repeated squaring. If <em style="color:blue"><e-phi></em>
is non zero, use the generalization of Fermat's little theorem:
b^phi(mod) = 1 mod mod, when the gcd of b and mod is 1. The theorem is
used to replace b^n with b^r where r = mod(n, phi(mod)) and phi is
the Euler Phi function.<div style="color:darkgreen">
Example: (rsm.mod:^ 213317 527131763 173) </div>
170<div style="color:darkgreen">
Example: (rsm.mod:^ 7 2134145213317 33 :e-phi 20) </div>
28</pre>
<h2 style="color=darkblue">euler-phi<b style="color=blue">  (n)</b></h2><pre>Computes the Euler Phi function of <em style="color:blue"><n></em>.<div style="color:darkgreen">
Example: (rsm.mod:euler-phi 15) </div>
8</pre>
<h2 style="color=darkblue">factors<b style="color=blue">  (n &key (no-dups t))</b></h2><pre>Computes and returns a list of the primes factors of <em style="color:blue"><n></em>. If <em style="color:blue"><no-dups></em> is
true, then no multiple entries of a factor are returned.<div style="color:darkgreen">
Example: (rsm.mod:factors 100) </div>
(2 5)<div style="color:darkgreen">
Example: (rsm.mod:factors 100 :no-dups nil) </div>
(2 2 5 5)</pre>
<h2 style="color=darkblue">gcd-with-pair<b style="color=blue">  (n m)</b></h2><pre>Returns two values: The gcd of <em style="color:blue"><n></em> and <em style="color:blue"><m></em>, and the list (r s) such that
r * n + s * m = gcd(n,m).<div style="color:darkgreen">
Example: (rsm.mod:gcd-with-pair 15 21) </div>
3
(3 -2)</pre>
<h2 style="color=darkblue">has-inverse-p<b style="color=blue">  (a n)</b></h2><pre>Does <em style="color:blue"><a></em> have an inverse in Z mod <em style="color:blue"><n></em>?<div style="color:darkgreen">
Example: (rsm.mod:has-inverse-p 10 100) </div>
nil</pre>
<h2 style="color=darkblue">inverse<b style="color=blue">  (a n &optional (error nil) (not-invert-return 0))</b></h2><pre>Finds the inverse of <em style="color:blue"><a></em> in Z mod <em style="color:blue"><n></em>. If <em style="color:blue"><a></em> inverse does not exist,
an error is thrown if <em style="color:blue"><error></em> is non nil. If <em style="color:blue"><error></em> is nil, then
<em style="color:blue"><not-invert-return></em> is returned.<div style="color:darkgreen">
Example: (rsm.mod:inverse 21 100) </div>
81</pre>
<h2 style="color=darkblue">ppow<b style="color=blue">  (b n p)</b></h2><pre>Raise <em style="color:blue"><b></em> to the <em style="color:blue"><n></em>th power in the field Z mod <em style="color:blue"><p></em>. Here <em style="color:blue"><p></em> must be prime.<div style="color:darkgreen">
Example: (rsm.mod:ppow 12 100 7) </div>
2</pre>
<h2 style="color=darkblue">rational-approx<b style="color=blue">  (number &optional (epsilon nil))</b></h2><pre>Find a simple rational approximation to <em style="color:blue"><number></em> within <em style="color:blue"><epsilon></em>.<div style="color:darkgreen">
Example: (rsm.mod:rational-approx pi 0.0000003) </div>
355/113</pre>
<h2 style="color=darkblue">solve-congruence-system<b style="color=blue">  (as ms)</b></h2><pre>Use the Chinese remainder theorem to solve for x, the system of
congruences: x = as_i mod ms_i. The moduli, <em style="color:blue"><ms></em>, must all be pairwise
relatively prime. x will be unique in Z mod (product of <em style="color:blue"><ms></em>'s).<div style="color:darkgreen">
Example: (rsm.mod:solve-congruence-system '(1 2 3) '(2 3 5)) </div>
23</pre></td></tr></table></body>
|