1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mote1985 [20]
3 years ago
9

Using pseudo-code, describe a recursive algorithm to find n! mod m, when m, n ? Z+.

Mathematics
1 answer:
Nadya [2.5K]3 years ago
3 0

Explanation:

A recursive algorithm has a terminating condition and a recursive rule.

The function "facMod" will terminate with an output of 0 if m ≤ n, because m would be a factor of n!. It will terminate with an output of 1 if n < 2.

Otherwise, it is the product mod m of n and the "facMod" of n-1.

  • facMod(m, n) : = If( m ≤ n, 0, If( n < 2, 1, Mod(n*facMod(m, n-1), m)))

__

In this code, the If(a, b, c) statement returns b for a=true, otherwise it returns c. The Mod(a, b) statement returns a modulo b.

You might be interested in
You’ve seen two methods for finding the area of ΔABC—using coordinate algebra (by hand) and using geometry software. How are the
Phantasy [73]

AnsweYou’ve seen two methods for finding the area of ΔABC—using coordinate algebra (by hand) and using geometry software. How are the two methods similar? How are they different? Why might coordinate algebra be important in making and using geometry software?

r:

Step-by-step explanation:

8 0
2 years ago
Which expression of signed decimal numbers has a positive quotient?
melomori [17]

Answer:

it would be -1.7 / -10.06 because if you divide 2 negative numbers than you get a positive number and if you divide a negative and a positive number than it would be negative

Hope this helps you ❤️

Step-by-step explanation:

7 0
3 years ago
What additional information can be used to prove ΔEFG ≅ ΔYXW by SSS?
navik [9.2K]
D because there sides are congruent
6 0
3 years ago
Read 2 more answers
Because Bernard has some health issues, he must pay 15% more for life insurance. About how much more annually will a $115,000 10
ruslelena [56]
<span>$24 or D, Hope this helps :D</span>
6 0
3 years ago
Read 2 more answers
Isabella has a bag of candy. She gives ½ of the bag to Kaleb. Kaleb gives 1/3 of the candy he now has to Scott. If Scott has 5 p
svp [43]

Answer:

15

Step-by-step explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • A person invest $10,000 into a bank the bank pays 4.75% interest compounded semi annually. To the nearest 10th of a year, how lo
    9·1 answer
  • Did I do this correctly? If not what’s the answer?
    10·2 answers
  • What is the value of x?
    9·1 answer
  • A rope 8 feet long is cut into two pieces. One piece is used to form a circle and the other used to form a square. Find a functi
    8·1 answer
  • The rectangle below has an area of 70y^8+30y^6
    13·1 answer
  • Kate runs 2/3 of a mile on Mondays, Wednesday's and Thursdays. She runs 4/5 of a mile on Tuesday and Fridays. How many miles doe
    13·1 answer
  • What is the answer to this?
    10·2 answers
  • Which postulate, if any can be used to prove the triangles congruent
    10·2 answers
  • Marie is bringing bagels and cream cheese to school as a birthday snack for her class. The cost of b bagels and c packages of cr
    9·1 answer
  • 1 pts
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!