Anonymous user
Special factorials: Difference between revisions
m
→{{header|REXX}}: simplified some code.
m (af(0) is 0) |
m (→{{header|REXX}}: simplified some code.) |
||
Line 186:
<lang rexx>/*REXX program to compute some special factorials: superfactorials, hyperfactorials,*/
/*───────────────────────────────────── alternating factorials, exponential factorials.*/
numeric digits 100 /*
if xef=='' | xef=="," then xef= nef /* " " " " " " */▼
if nrf=='' | nrf=="," then nrf= 10 /* " " " " " " */▼
@= 'the number of decimal digits in the exponential factorial of '
say @
@= 'the inverse factorial of
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 213 ⟶ 205:
commas: parse arg ?; do jc=length(?)-3 to 1 by -3; ?=insert(',', ?, jc); end; return ?
ef: procedure; parse arg x; if x==0 | x==1 then return 1; return x**ef(x-1)
efn: procedure; parse arg x; numeric digits 9; x= x; parse var x 'E' d;
sf: procedure; parse arg x; != 1; do #=2 to x; != ! * !(#); end; return !
hf: procedure; parse arg x; != 1; do #=2 to x; != ! * #**#; end; return !
hdr: parse arg ?,,$; say 'the first ten '?"factorials:"; return
{{out|output|text= when using the internal default input:}}
<pre>
|