Everyone is probably familiar with a factorial. 5 factorial is:
5! -> 5 x 4 x 3 x 2 x 1 = 120
For this challenge, reverse it! Write LabVIEW code that tells us if our input number is a factorial or not.
If the number is a factorial it should return 'x!' where x is the factorial number.
E.g. 120 is 5 factorial, return '5!'
If the number is not a factorial it should return 'NONE'
The code should handle input numbers up to 9,223,372,036,854,775,807
This thread is intended as a place to ask questions, discuss the challenge and upload your solutions.
We briefly discussed measuring execution time for the discussed solutions. However (and this is a little bit of a hint), for this problem, it's not particularly meaningful, as a fast solution won't run long enough to allow for a reliable difference to be detected, at least not on a Windows system.
Measuring execution time can be interesting, however, both for debugging and for performance profiling of your application. To this end, I can recommend these custom LabVIEW probes that I found a while back, which you can use to measure the execution time between probes on an error wire, in ms or µs:
Here is an arithmetic solution, taking care of the definition 0! = 1 and that x! = 0 has no solution.
Here is what came to my head today. I can't imagine someone trying to do similar staff using script languages. Labview is much more convenient
The deadline has passed, but anyway... here's a rather readable pattern that could be useful for many similar tasks. The 'First Call?' part might need to be adapted to the particular situation where the VI is called, though.Per Erik Ruberth,