This Problem of the Week involves determining the identity of a well-known mathematical function by examining the algorithm used on the input number to produce the output. The function will only accept integers that are greater than or equal to zero. The following is the mathematical definition of the function:
Function | Definition | Condition |
---|---|---|
unnamed(n) = | 1 | if n = 0 |
n × unnamed(n – 1) | if n > 0 |
If you are a JavaScript/JScript person, here is the equivalent JavaScript code for this unnamed function:
function unnamed(n) {
if(n == 0)
return 1;
if(n > 0)
return n * unnamed(n - 1);
}
With the above definitions for this unnamed function, what mathematical function would you say this function is equivalent to?
The answer to this Problem of the Week was posted on February 13, 2012 at 12:00 AM (EST) and can be found here.
1 Comment
POW Answer – Unnamed Function #1 | Chris West's Blog · February 13, 2012 at 12:03 AM
[…] answer to last week’s Problem of the Week is that the following definitions represent the factorial of the given non-negative […]