Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,21 +1,21 @@
|
|||
/*REXX pgm calculates K-fact (multifactorial) of non-negative integers.*/
|
||||
numeric digits 1000 /*lets get ka-razy with precision*/
|
||||
parse arg num deg . /*allow user to specify num & deg*/
|
||||
if num=='' | num==',' then num=15 /*Not specified? Then use default*/
|
||||
if deg=='' | deg==',' then deg=10 /* " " " " " */
|
||||
say '═══showing multiple factorials (1 ──►' deg") for numbers 1 ──►" num
|
||||
/*REXX program calculates K-fact (multifactorial) of non-negative integers. */
|
||||
numeric digits 1000 /*get ka-razy with the decimal digits. */
|
||||
parse arg num deg . /*get optional arguments from the C.L. */
|
||||
if num=='' | num==',' then num=15 /*Not specified? Then use the default.*/
|
||||
if deg=='' | deg==',' then deg=10 /* " " " " " " */
|
||||
say '═══showing multiple factorials (1 ──►' deg") for numbers 1 ──►" num
|
||||
say
|
||||
do d=1 for deg /*the factorializing (º) of !'s. */
|
||||
_= /*the list of factorials so far. */
|
||||
do f=1 for num /* ◄── do a ! from 1 to num.*/
|
||||
_=_ Kfact(f,d) /*construct a list of factorials.*/
|
||||
end /*f*/ /*(above) D can default to 1.*/
|
||||
do d=1 for deg /*the factorializing (degree) of !'s.*/
|
||||
_= /*the list of factorials (so far). */
|
||||
do f=1 for num /* ◄── perform a ! from 1 ───► number.*/
|
||||
_=_ Kfact(f, d) /*build a list of factorial products. */
|
||||
end /*f*/ /*(above) D can default to unity. */
|
||||
|
||||
say right('n'copies("!", d),1+deg) right('['d"]",2+length(num))':' _
|
||||
say right('n'copies("!", d),1+deg) right('['d"]", 2+length(num))':' _
|
||||
end /*d*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────KFACT subroutine────────────────────*/
|
||||
Kfact: procedure; !=1; do j=arg(1) to 2 by -word(arg(2) 1, 1)
|
||||
!=!*j
|
||||
end /*j*/
|
||||
return !
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*────────────────────────────────────────────────────────────────────────────*/
|
||||
Kfact: procedure; !=1; do j=arg(1) to 2 by -word(arg(2) 1, 1)
|
||||
!=!*j
|
||||
end /*j*/
|
||||
return !
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue