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
A certain star is 2.6×102 light years from the Earth. One light year is about 5.9×1012 miles. How far from the earth​ (in miles)
navik [9.2K]

Answer:

2.5 x 10^{15} miles

3 0
3 years ago
Read 2 more answers
5 1/4* (-4 2/3)<br> Solve
leonid [27]

Answer:

-10/3, -3  1/3, or -3.33333333...........

Step-by-step explanation:

First, just multiply the whole numbers by the fractions and then multiply those tow numbers by each other. Hope this helped!!

6 0
3 years ago
Read 2 more answers
Plz someone help. Urgent homework.
Arlecino [84]

Answer:

1

Step-by-step explanation:

4 0
3 years ago
345 ft/min = ___________ ft/h
Pavlova-9 [17]

the rate given is 345 ft/min

this means within 1 min distance is - 345 ft

we have to convert this speed to ft/h

1 hour is equivalent to 60 minutes

so if 60 minutes equals 1 hour

1 minute is equal to - 1/60 hr

so the distance within 1 minute is - 345 ft

since 1 min = 1/60 hr

distance within 1/60 hour = 345 ft

therefore distance in 1 hour = \frac{345}{1/60} = 345 * 60 = 20 700 ft

answer is 20 700 ft/h

8 0
4 years ago
Read 2 more answers
Whats the y intercept of a(n)=6(n-1)-5
jeka57 [31]
The y-intercept is (0,-11)
3 0
3 years ago
Other questions:
  • Round the underlined digit 5,291 the underlined is 9
    9·2 answers
  • If p varies directly with q, and p = 10 when q = 2, what is the value of p when q = 20?
    13·1 answer
  • PLS HELP ME ASAP Which situation can be simulated by rolling a six-sided die once?
    13·2 answers
  • Help me please will brainlist
    8·1 answer
  • Help me please i’ll give extra points
    6·2 answers
  • Pls pls help help help
    10·2 answers
  • Which of the following is equivalent to 0 equals 3 x squared minus 12 x minus 15 when completing the square?
    7·1 answer
  • Set up equations and solve.
    9·1 answer
  • Find the product binomial expression of;<br><br>(x-5) (8-5)​
    7·1 answer
  • What's the answer to 2.4(-3.3-0.9+1.2)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!