Hyper Factorial
Hyperfactorial of a number is obtained by multiplying consecutive integers from 1 to the given number, each raised to its on power. This video demonstrates how to compute the hyperfactorial for any number or a range of numbers in Z. Enjoy watching and try the code in ZCubes.
Video
ZCubes Code
1. Hyperfactorial of 5 can be calculated using the function:
PRODUCT((1..5)@"x^x") ...displays output as 86400000
2. A generalized function can be defined to calculate the hyper factorial of any nth term as shown below:
hyperfactorial:=PRODUCT((1..n)@"x^x");
The function can be called from another Z3 editor window as:
hyperfactorial(5);
3. To find the hyper factorial for range of numbers, the above function can be modified as:
hyperfactorial:=PRODUCT((1..n)@"x^x"); hyperfactorial#;
The function can be called from another Z3 editor window as:
hyperfactorial(1..5);
© Copyright 1996-2021, ZCubes, Inc.