This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
factorials [2014/04/08 01:56] 127.0.0.1 external edit |
factorials [2014/05/24 04:34] (current) Jay.Tanner.x@PHPScienceLabs.us |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOCACHE~~ | ~~NOCACHE~~ | ||
~~DISCUSSION:off~~ | ~~DISCUSSION:off~~ | ||
- | Back to: **[[Arbitrary-Precision Math]]** | + | Back to: **[[INDEX]]** | **[[Arbitrary-Precision Math]]** |
----- | ----- | ||
=====Factorials===== | =====Factorials===== | ||
Line 90: | Line 90: | ||
// Print out the computed table. | // Print out the computed table. | ||
- | print "<b><pre>\nN N!\n$FactorialTable</pre></b>\n<br><br><br>"; | + | print "<b><pre>\nN N!\n$FactorialTable</pre></b>\n"; |
- | + | ||
- | + | ||
- | // =========================================================== | + | |
- | function bcN_Factorial ($N=0) | + | |
- | { | + | |
- | $n = bcadd($N, 0); | + | |
- | + | ||
- | if (!is_numeric($n) or $n < 0 or $n > 9999) {return FALSE;} | + | |
- | + | ||
- | $P=1; for ($i=1; $i <= $n; $i++) {$P = bcmul($P, $i);} | + | |
- | + | ||
- | return $P; | + | |
- | } | + | |
?> | ?> | ||
Line 136: | Line 123: | ||
// Print out the computed table. | // Print out the computed table. | ||
- | print "<b><pre>\nN N!\n$out</pre></b>\n<br><br><br>"; | + | print "<b><pre>\nN N!\n$out</pre></b>\n"; |
- | |||
- | function bcN_Factorial ($N=0) | ||
- | { | ||
- | if (!is_numeric($N) or $N < 0 or $N > 9999) {return FALSE;} | ||
- | |||
- | $n = bcadd($N, 0); | ||
- | |||
- | $P=1; for ($i=1; $i <= $n; $i++) {$P = bcmul($P, $i);} | ||
- | |||
- | return $P; | ||
- | } | ||
</php> | </php> | ||
- | **By examining the above table, you can see how rapidly the values of factorials increase.** | + | **By examining the above table, one can see how rapidly the values of factorials increase.** |
\\ \\ | \\ \\ | ||