Difference between revisions of "ZCubes/Hyper Factorial"

From ZCubes Wiki
Jump to navigation Jump to search
 
Line 4: Line 4:
 
==Video==
 
==Video==
 
<br/>
 
<br/>
{{#ev:youtube|t8yMMvUf6uI|480|left|Brocards Problem & Brown Numbers}}
+
{{#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>
  
  

Latest revision as of 06: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


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.