Difference between revisions of "ZCubes/Hyper Factorial"
Jump to navigation
Jump to search
(Created page with "==Hyper Factorial== <br/> Hyperfactorial of a number is obtained by multiplying consecutive integers from 1 to the given number, each raised to its on power. This video demon...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 4: | Line 4: | ||
==Video== | ==Video== | ||
<br/> | <br/> | ||
− | {{#ev:youtube|t8yMMvUf6uI|480|left| | + | {{#ev:youtube|t8yMMvUf6uI|480|left|Hyper Factorial}} |
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | ||
+ | ==ZCubes Code== | ||
+ | 1. Hyperfactorial of 5 can be calculated using the function: | ||
− | < | + | <pre> |
+ | PRODUCT((1..5)@"x^x") | ||
+ | |||
+ | ...displays output as 86400000 | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | 2. A generalized function can be defined to calculate the hyper factorial of any nth term as shown below: | ||
+ | <pre> | ||
+ | hyperfactorial:=PRODUCT((1..n)@"x^x"); | ||
+ | </pre> | ||
+ | |||
+ | The function can be called from another Z3 editor window as: | ||
+ | <pre> | ||
+ | hyperfactorial(5); | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | 3. To find the hyper factorial for range of numbers, the above function can be modified as: | ||
+ | <pre> | ||
+ | hyperfactorial:=PRODUCT((1..n)@"x^x"); | ||
+ | hyperfactorial#; | ||
+ | </pre> | ||
+ | |||
+ | The function can be called from another Z3 editor window as: | ||
+ | <pre> | ||
+ | hyperfactorial(1..5); | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | <br/> | ||
+ | *[[Z3 | Z3 home]] | ||
+ | *[[Z^3 Language Documentation]] | ||
+ | *[[ZCubes_Videos | ZCubes Videos and Tutorials]] | ||
+ | *[[Main_Page | About ZCubes ]] | ||
+ | <br/> | ||
<br/> | <br/> | ||
− | © Copyright 1996- | + | © Copyright 1996-2021, ZCubes, Inc. |
Latest revision as of 05:09, 17 September 2021
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.