⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rpncalc.html

📁 一个VB小程序,能够进行大数的计算,可以作为学习的参考
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Catalogue of RPN large integer calculator functions</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="author" content="Sjoerd.J.Schaper" />
<meta name="description" content="RPN large integer calculator function catalogue" />
<style type="text/css">
body {
 font-family:"Times New Roman",serif;
 font-weight:bold;
 font-size:108%;
 line-height:1.3em;
 text-align:justify;
 background:#fefaf2;
 margin:2% 3% 3% 2%;
 padding: 0;
}
h1 {
 font-size:140%;
 text-align:left;
}
h2 {
 font-size:106%;
 text-align:left;
}
hr {
 width:78%;
 text-align:left;
 margin-left: 0;
}
ul {
 text-align:left;
 list-style-type:disc;
 margin:0 0 0 2%;
 padding: 0;
}
span.blue {
 color:#000090;
}
span.green {
 color:#006030;
}
</style>
</head>

<body>
<h1>Catalogue of RPN large integer calculator functions.</h1>

<h2>{button caption}<br />
function description,<br />
registers in/out.</h2>

<p>Framewise from left to right:
&#160;
<a href="#f01">1</a>
&#160;
<a href="#f02">2</a>
&#160;
<a href="#f03">3</a>
&#160;
<a href="#f04">4</a>
&#160;
<a href="#f05">5</a>
&#160;
<a href="#f06">6</a></p>

<hr id="f01" />

<p>{confrc}<br />
Continued fraction representation of rational a &frasl; b, truncated at<br />
the first convergent p &frasl; q for which q &ge; n.<br />
In: Z(a), Y(b), X(n); out: Y(p), X(q), Textbox(partial quotients).</p>

<p>{farey}<br />
Find the successor of rational a &frasl; b in the Farey series of order n:<br />
the ascending series of irreducible fractions between 0 and 1 with<br />
denominators &le; n.<br />
In: Z(a), Y(b), X(n); out: Y(p), X(q).</p>

<p>{bezout}<br />
Find the smallest solution of indeterminate equation
&nbsp;a &middot; x &minus; b &middot; y = c<br />
(aka. B&eacute;zout's identity), equivalent to the congruence
&nbsp;a &middot; x &equiv; c (mod b).<br />
This fails if the gcd(a, b) does not divide c. &nbsp;Input c = 0 to compute<br />
a &middot; x &minus; b &middot; y = gcd(a, b).<br />
In: Z(a), Y(b), X(c); out: Y(x), X(y).</p>

<p>{gcd}<br />
Greatest common divisor of integers a and b: the largest positive integer<br />
which divides both a and b.<br />
In: Y(a), X(b); out: X(gcd).</p>

<p>{lcm}<br />
Least common multiple of integers a and b: the smallest positive integer<br />
which is divisible by both a and b.<br />
In: Y(a), X(b); out: X(lcm).</p>

<hr id="f02" />

<p>{modpwr}<br />
Modular exponentiation: raise base a to the k-th power and reduce modulo m.<br />
In: Z(a), Y(k), X(m); out: Y(power), X(m).</p>

<p>{modord}<br />
Calculate the Euler totient function &phi;(m)
and the order of &nbsp;a modulo m:<br />
the smallest positive value of &nbsp;x &nbsp;for which
&nbsp;a^x &equiv; 1 (mod m).<br />
This fails if &nbsp;a and m &nbsp;are not coprime or if the calculator
cannot factorize &nbsp;m.<br />
Press F1 to break off, repeat if necessary.<br />
If &nbsp;base a = 1, then the order is set to &phi;(m).<br />
If &phi;(m) is equal to the Carmichael &nbsp;&lambda;-function for m,<br />
then the least positive primitive root of m is also given.<br />
In: Y(a), X(m);<br />
out: Z(a), Y(x), X(m), &nbsp;Textbox(&phi;(m) and either &lambda;(m) or the root).</p>

<p>{modinv}<br />
Multiplicative inverse or associate of a to modulus m: x such that<br />
a &middot; x &equiv; 1 (mod m). This fails if a and m are not coprime.<br />
In: Y(a), X(m); out: Y(x), X(m).</p>

<p>{modsqr}<br />
Calculate Kronecker's symbol for a and m, and solve quadratic congruence<br />
x^2 &equiv; a (mod m). This fails if &nbsp;a &nbsp;is a quadratic nonresidue
&nbsp;modulo m<br />
or if &nbsp;m &nbsp;is composite and cannot be factorized by the calculator.<br />
In: Y(a), X(m); out: Y(x), X(m), Textbox((a &frasl; m)).</p>

<p>{chinese}<br />
Find the solution of simultaneous congruences
&nbsp;x &equiv; a (mod m) and x &equiv; b (mod n)<br />
with the Chinese remainder theorem. This fails if the gcd(m, n) does not<br />
divide &nbsp;b &minus; a.<br />
In: S(a), Z(m), Y(b), X(n); out: Y(x), X(modulus).</p>

<hr id="f03" />

<h2>Basic operations</h2>
<p>This frame may be switched into different calculation modes by clicking it.</p>
<ul>
<li>Default mode (colour black, caption Z)<br />
Operations are done on signed integer numbers (ring Z).</li>
<li>Rational mode (<span class="blue">colour blue</span>, caption Q)<br />
Operations are done on rational integers (field Q).<br />
The numbers in registers S, Z, Y and X are interpreted pairwise as<br />
rationals a &frasl; b.</li>
<li>Quadratic mode (<span class="green">colour green</span>, caption K)<br />
Operations are done on integers in quadratic ring &nbsp;K = Z(&radic;d).<br />
The number in register T (the top of the stack) is taken as radicand &nbsp;d,<br />
the numbers in registers S, Z, Y and X are interpreted pairwise as<br />
algebraic integers &nbsp;a + b&radic;d.</li>
</ul>

<p>{mod}<br />
Residue of a to modulus m: positive solution of
&nbsp;x &equiv; a (mod m).<br />
In: Y(a), X(m); out: X(x).<br />
<span class="blue">In: S(a), Z(b), Y(p), X(q);
out: Y(0), X(1).</span><br />
<span class="green">In: T(d), S(a), Z(b), Y(u), X(v);
out: Y(x), X(y),<br />
with &nbsp;x + y&radic;d
&nbsp;= w &minus; trunc(w &frasl; z) &times; z,
&nbsp;w = a + b&radic;d, &nbsp;z = u + v&radic;d.</span></p>

<p>{a^k}<br />
Exponentiation: raise base a to the k-th power.<br />
In: Y(a), X(k); out: X(power).<br />
<span class="blue">In: Z(a), Y(b), X(k);
out: Y(a^k), X(b^k), &nbsp;k &isin; N.</span><br />
<span class="green">In: T(d), Z(a), Y(b), X(k);
out: Y(x), X(y),<br />
with &nbsp;x + y&radic;d
&nbsp;= (a + b&radic;d)^k, &nbsp;k &isin; N.</span></p>

<p>{a^2}<br />
The square of a.<br />
In: X(a); out: X(square).<br />
<span class="blue">In: Y(a), X(b);
out: Y(a^2), X(b^2).</span><br />
<span class="green">In: T(d), Y(a), X(b);
out: Y(x), X(y),<br />
with &nbsp;x + y&radic;d
&nbsp;= (a^2 + b^2&middot;d) + 2ab&radic;d.</span></p>

<p>{sqrt}<br />
Integer square root of a &ge; 0.<br />
In: X(a); out: X(root).<br />
<span class="blue">In: Y(a), X(b);
out: Y(&radic;a), X(&radic;b).</span><br />
<span class="green">In: T(d), Y(a), X(b);
out: Y(x), X(y),<br />
with &nbsp;x + y&radic;d &nbsp;= (a + b&radic;d)^&frac12;.</span></p>

<p>{&divide;}<br />
Integer division.<br />
In: Y(a), X(b); out: X(a &frasl; b).<br />
<span class="blue">In: S(a), Z(b), Y(p), X(q);
out: Y(aq), X(bp).</span><br />
<span class="green">In: T(d), S(a), Z(b), Y(u), X(v);
out: Y(x), X(y),<br />
with &nbsp;x + y&radic;d
&nbsp;= (au &minus; bv&middot;d) &frasl; t + (bu &minus; av)&radic;d &frasl; t,
&nbsp;t = u^2 &minus; v^2&middot;d.</span></p>

<p>{&times;}<br />
Multiplication.<br />
In: Y(a), X(b); out: X(a &times; b).<br />
<span class="blue">In: S(a), Z(b), Y(p), X(q);
out: Y(ap), X(bq).</span><br />
<span class="green">In: T(d), S(a), Z(b), Y(u), X(v);
out: Y(x), X(y),<br />
with &nbsp;x + y&radic;d
&nbsp;= (au + bv&middot;d) + (bu + av)&radic;d.</span></p>

<p>{+}<br />
Addition.<br />
In: Y(a), X(b); out: X(a + b).<br />
<span class="blue">In: S(a), Z(b), Y(p), X(q);
out: Y(aq + bp), X(bq).</span><br />
<span class="green">In: S(a), Z(b), Y(u), X(v);
out: Y(a + u), X(b + v).</span></p>

<p>{&minus;}<br />
Subtraction.<br />
In: Y(a), X(b); out: X(a &minus; b).<br />
<span class="blue">In: S(a), Z(b), Y(p), X(q);
out: Y(aq &minus; bp), X(bq).</span><br />
<span class="green">In: S(a), Z(b), Y(u), X(v);
out: Y(a &minus; u), X(b &minus; v).</span></p>

<p>{shr}<br />
Shift a one bit to the right.<br />
In: X(a); out: X(a &frasl; 2).<br />
<span class="blue">In: Y(a), X(b);
out: Y(a), X(b &times; 2).</span><br />
<span class="green">In: Y(a), X(b);
out: Y(a &frasl; 2), X(b &frasl; 2).</span></p>

<p>{shl}<br />
Shift a one bit to the left.<br />
In: X(a); out: X(a &times; 2).<br />
<span class="blue">In: Y(a), X(b);
out: Y(a &times; 2), X(b).</span><br />
<span class="green">In: Y(a), X(b);
out: Y(a &times; 2), X(b &times; 2).</span></p>

<p>{inc}<br />
Increment a by one.<br />
In: X(a); out: X(a + 1).<br />
<span class="blue">In: Y(a), X(b);
out: Y(a + 1), X(b).</span><br />
<span class="green">In: Y(a), X(b);
out: Y(a + 1), X(b).</span></p>

<p>{dcr}<br />
Decrement a by one.<br />
In: X(a); out: X(a &minus; 1).<br />
<span class="blue">In: Y(a), X(b);
out: Y(a &minus; 1), X(b).</span><br />
<span class="green">In: Y(a), X(b);
out: Y(a &minus; 1), X(b).</span></p>

<hr id="f04" />

<h2>Memory buttons</h2>
<p>{sto}<br />
Store the contents of registers X (display) and Y (stack bottom) into memory.</p>

<p>{rcl}<br />
Recall the memory contents and put them into registers X and Y.</p>

<h2>Stack manipulation</h2>
<p>[Enter] (has no button equivalent)<br />
Save the value in the display (copy register X to Y and lift the stack).</p>

<p>{last} or [Up Arrow]<br />
Exchange the current stack with the stack before the last operation.</p>

<p>{clear} or [Insert]<br />
Clear the current stack.</p>

<p>{clx} or numeric .[Del]<br />
Cancel entry (clear the display).</p>

<p>{roll} or [Page Up]<br />
Roll the stack one level up.</p>

<p>{drop} or [Page Down]<br />
Drop the stack one level down.</p>

<p>{x&#171;&#187;y} or [Down Arrow]<br />
Swap the X (display) and Y (stack bottom) registers.</p>

<hr id="f05" />

<p>{bino}<br />
Binomial coefficient or combination &nbsp;n choose k: the coefficient of<br />
x^k in (1 + x)^n, also the number of k-subsets possible out of a set of<br />
n distinct items. &nbsp;Positive k &le; abs(n) &lt; 10^9.<br />
In: Y(n), X(k); out: X(binomial coefficient).</p>

<p>{n!}<br />
Factorial of integer abs(n) &lt; 10^4: the number of ways in which n objects<br />
can be permuted, defined as
&nbsp;n &middot; (n &minus; 1) &middot; &middot; &middot; 2 &middot; 1.<br />
In: X(n); out: X(factorial).</p>

<p>{rnd}<br />
Random positive integer a with length abs(l) &lt; 10^4.<br />
In: X(l); out: X(random a).</p>

<p>{chs}<br />
Change the sign of integer a.<br />
In: X(a); out: X(-a).</p>

<p>{fibo}<br />
Fibonacci number Fn, defined by the recurrence relation
&nbsp;Fn+1 = Fn + Fn-1,<br />
with &nbsp;F1 = F2 = 1 and index abs(n) &lt; 2^16.<br />
In: X(n); out: X(Fn).</p>

<p>{10^k}<br />
Exponentiation: raise base 10 to the k-th power, abs(k) &lt; 10^4.<br />
In: X(k); out: X(power).</p>

<p>{prim}<br />
Find the next probable prime &ge; abs(a) with the 1980 Miller-Rabin strong<br />
pseudoprime test. Press F1 to break off.<br />
In: X(a); out: X(next prime).</p>

<p>{split}<br />
Attempt to split abs(a) in two factors. &nbsp;Press F1 to break off.<br />
If &nbsp;a is prime and &nbsp;a &equiv; 1 (mod 4)
&nbsp;then abs(a) is factored into conjugate<br />
Gaussian primes &nbsp;x &plusmn; yi &nbsp;in the quadratic ring
&nbsp;K = Z(&radic;&minus;1).<br />
The continued fraction expansion of &nbsp;a &frasl; r,
with r&sup2; &equiv; &minus;1 (mod a) is also given.<br />
In: X(a); out: Y(f &nbsp;or x), X(a &frasl; f &nbsp;or y),
Textbox(partial quotients).</p>

<hr id="f06" />

<p>{a &frasl; b}<br />
Decimal expansion of rational number a &frasl; b.<br />
In: Y(a), X(b); out: Textbox(decimal fraction).</p>

<p>{1 &frasl; a}<br />
Decimal expansion of the reciprocal of nonzero integer a.<br />
In: X(a); out: Textbox(decimal fraction).</p>

<p>{funit}<br />
Power basis representation of the fundamental unit
&nbsp;(p + q&radic;d) &frasl; 2<br />
for the quadratic ring &nbsp;K = Z(&radic;d),
&nbsp;with positive d &lt; 10^9.<br />
Also given are the continued fraction expansion of the irrational<br />
and a decimal approximation of the real square root.<br />
In: X(d); out: Y(p), X(q), Textbox(partial quotients, decimal root).</p>

<p>{divf}<br />
Divisor functions &mu;(a), &omega;(a), &Omega;(a), &delta;(a) and &sigma;(a)
of nonzero integer abs(a).<br />
This fails if the calculator cannot factorize a.
&nbsp;Press F1 to break off.<br />
In: X(a); out: Y(&sigma;(a)), Textbox(prime factors and function values).</p>

<p>{bin}<br />
Binary representation of integer a.<br />
In: X(a); out: Textbox(bit vector).</p>
<hr />

<h2>Note on factorization</h2>
<p>A number is first divided by all primes &lt; 2^17, then the Pollard-Brent<br />
Monte Carlo rho-algorithm is applied to the residue. Successive random<br />
mappings are continued for 2^16 iterations each, until a factor is found.<br />
The splitting process is then repeated recursively. Most numbers with<br />
up to 25 figures will be fully factorized, bigger ones only if they're smooth.</p>
<hr />

<p>Copyright &#169; december 2004 by Sjoerd.J.Schaper</p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -