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]
2 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]2 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
Can I have help? With this it’s due today and it’s really hard high school level
Anna007 [38]
J=1

explaination:
2 is greater than or equal to 3
4 - j(1)= 3
4 0
2 years ago
Read 2 more answers
If the farmers market sold 35% of its produce and has 280 peaches remaining, how many peaches did it have?
PSYCHO15rus [73]

100-35 = 65%

280/0.65 = 430

 he had 430 peaches


3 0
3 years ago
Joe has a savings account and a credit card. He has $422 saved in his savings account and has purchased $484 worth of merchandis
denis23 [38]
It will be negative because he has 422 but purchased 484 which is more than he has . so he is a negativge nuber because owns money
6 0
3 years ago
Helppp please i need helppppppppoooo
bixtya [17]
Answer
A)

Explanation


4 0
2 years ago
Read 2 more answers
Help pls pls pls !!!!
kramer

Answer:

AAS

Step-by-step explanation:

I believe

6 0
2 years ago
Other questions:
  • HELP PLEASE!!!!!✊- 15 pts.<br><br><br> If there is an 8% tax on a $20 shirt was is the tax amount?
    15·2 answers
  • Simplify: − (sq root)16x2 if x&lt;0.
    9·1 answer
  • Sanjeet bought a new car at the dealership for $28,000. It is estimated that the value of the new car will decrease 8% each year
    9·2 answers
  • Solve this equation will mark brainlyest
    6·2 answers
  • Does anyone know how to do this ?
    8·1 answer
  • Graph lines and find the solution ( where do the lines cross)<br><br>y=1/2x + 5<br>y= -5/2x -1​
    10·1 answer
  • A city's population increases by 5% every year. If its population today is 300,000, write a function that models the population
    10·1 answer
  • Carl buys a printer for his office on January 1, 2012 for $15,000. He estimates the machine to have a useful life of 10 years. T
    15·1 answer
  • Nikko scored 90, 98, 87, 85 and 95 on his seatwork. What is his average score?
    7·2 answers
  • What is this number in standard form?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!