Matlab: factorials without for loops or colon

AI Thread Summary
The discussion centers on creating a MATLAB function to calculate the factorial of a positive integer without using loops, the factorial function, or the colon operator. Participants initially express uncertainty about how to approach the problem, particularly without traditional iterative methods. A hint towards using recursion is suggested, which leads to a breakthrough for one participant. The conversation highlights the challenge of implementing the solution while adhering to the specified constraints. Ultimately, the use of recursion is identified as the key to solving the problem effectively.
koryargonic
Messages
3
Reaction score
0
The Problem: Write a function that finds the factorial of a positive integer without using for or while loops, the factorial function, or the : range operator.

Honestly, I don't really know how to start with this one. If I were able to use a for loop it would be easy, and I don't see how I can do this with conditionals. Any ideas/hints?
 
Physics news on Phys.org
Think recursion.
 
Ooh, thanks. I got it.
 
Back
Top