Question
Give a recursive algorithm for finding $n ! \bmod m$ when- ever $n$ and $m$ are positive integers.
Step 1
In the case of factorial, the base case is when $n=1$. In this case, we simply return 1 because $1! = 1$. Show more…
Show all steps
Your feedback will help us improve your experience
Lucas Gagne and 86 other Precalculus educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Give a recursive algorithm for computing $n x$ whenever $n$ is a positive integer and $x$ is an integer, using just addition.
Induction and Recursion
Recursive Algorithms
Devise a recursive algorithm for finding $x^{n}$ mod $m$ when- ever $n, x,$ and $m$ are positive integers based on the fact that $x^{n}$ mod $m=\left(x^{n-1} \bmod m \cdot x \bmod m\right) \bmod m .$
Give a recursive algorithm for finding the sum of the first n positive integers.
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD