How to resolve the algorithm Multifactorial step by step in the Maple programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Multifactorial step by step in the Maple programming language
Table of Contents
Problem Statement
The factorial of a number, written as
n !
{\displaystyle n!}
, is defined as
n !
n ( n − 1 ) ( n − 2 ) . . . ( 2 ) ( 1 )
{\displaystyle n!=n(n-1)(n-2)...(2)(1)}
. Multifactorials generalize factorials as follows: In all cases, the terms in the products are positive integers. If we define the degree of the multifactorial as the difference in successive terms that are multiplied together for a multifactorial (the number of exclamation marks), then the task is twofold:
Note: The wikipedia entry on multifactorials gives a different formula. This task uses the Wolfram mathworld definition.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Multifactorial step by step in the Maple programming language
Source code in the maple programming language
f := proc (n, m)
local fac, i;
fac := 1;
for i from n by -m to 1 do
fac := fac*i;
end do;
return fac;
end proc:
a:=Matrix(5,10):
for i from 1 to 5 do
for j from 1 to 10 do
a[i,j]:=f(j,i);
end do;
end do;
a;
You may also check:How to resolve the algorithm Tonelli-Shanks algorithm step by step in the REXX programming language
You may also check:How to resolve the algorithm Sorting algorithms/Cocktail sort with shifting bounds step by step in the Nim programming language
You may also check:How to resolve the algorithm Singly-linked list/Traversal step by step in the Wart programming language
You may also check:How to resolve the algorithm Shoelace formula for polygonal area step by step in the Visual Basic .NET programming language
You may also check:How to resolve the algorithm Death Star step by step in the Openscad programming language