ZCubes/Hyper Factorial

Revision as of 05:09, 17 September 2021 by Swapna (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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


Hyper Factorial














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.