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
What’s the difference between evaluating an expression for a given value of a variable and solving an equation?
Talja [164]
The difference is that evaluating an expression for a given value is an example of let’s say In a example, the variable x is equal to 6 since 6 + 6 = 12. So it means that they are giving you the input already. SOLVING an equation is working backwards, to undo everything that has been done to the input. So you have to do the equation in order to find your answer.
6 0
2 years ago
A model rocket is launched from a roof into a large field. The path of the rocket can be modeled by the equation
Alexxx [7]
Ok

y=-0.04x^2+8.3x+4.3
when the rocket reaches the ground (when height=0, ie when y=0), then the rocket will land, find the x coordinate

set y=0
0=-0.04x^2+8.3x+4.3
use quadratic formula
if you have ax^2+bx+c=0, then
x=\frac{-b+/- \sqrt{b^{2}-4ac} }{2a}
a=-0.04
b=8.3
c=4.3
x=\frac{-8.3+/- \sqrt{8.3^{2}-4(-0.04)(8.3)} }{2(-0.04)}
x=208.017 or -0.516785
xrepresents horizontal distance
you cannot have a negative horizontal distance unless you fired and theh wind blew it backwards
therefor x=280.017 is the answer
208.02 m


7 0
3 years ago
HELP!
kondor19780726 [428]
144/200=0.72 or 72%

225/100=2.25 or 225%

42/50=0.84 or 84%

Brainliest?
6 0
2 years ago
Read 2 more answers
The graph of a linear function is shown.
lawyer [7]

Answer:

Step-by-step explanation:

y=1/5+0 is the answer to your problem I very much believe

4 0
2 years ago
Choose all of the problems that result in an answer of 8.5.
Alexxx [7]

Answer:E

Step-by-step explanation:

Type it all into a calculator

6 0
3 years ago
Read 2 more answers
Other questions:
  • Three less than 5 times a number is less than or equal to 17.
    14·1 answer
  • After paying $5.67 for a pizza, Mike has $31.84. With how much money did he
    14·1 answer
  • Which expressions are equivalent to 16? Select each correct expression
    5·1 answer
  • Pls help me i only have a few mins to answer this question, thank you!
    15·1 answer
  • Two friends, Caleb and Ynez are both selling brownies for a class fundraiser. They decide to advertise how much buying a certain
    5·1 answer
  • Jada's pet turtle walked 12 feet, and then that length again.
    15·1 answer
  • The diameter of a circle is 14 inches. What is the area? Give the exact answer in simplest form
    11·2 answers
  • Pythagorean Theorem
    7·2 answers
  • Robert is preheating his oven before using it to bake. The initial temperature of the oven is 65° and the temperature will incre
    6·1 answer
  • Daniel has $30 in a savings account that earns 5%
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!