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
Mitchell use one fourth of a carton of 12 eggs to make an omelette how many eggs did she use
Leto [7]
3 Eggs: 4 times what equals 12? (We use 4 because its 1/4 or a quarter) 3 times 4 equals 12.
6 0
3 years ago
Read 2 more answers
There are 30 students in Mrs. Taylor's kindergarten class. If there are twice as many students with blond hair as with blue eyes
weqwewe [10]

Answer:

  11

Step-by-step explanation:

Let e represent the number of students with blue eyes. Then the number of students with blond hair is 2e. The total number of students is ...

  3 + e + 2e -6 = 30

We subtracted 6 because the expressions e and 2e cause the 6 students with both blond hair and blue eyes to be counted twice.

  3e = 33 . . . . add 3 and simplify

  e = 11

11 students have blue eyes.

5 0
3 years ago
Ella works in a music shop and earns $45 per day. She earns an extra $3 for each CD she sells. If Ella wants to earn at least $6
alex41 [277]
45+3n > $60 I hope this helps you out!!!
7 0
3 years ago
Read 2 more answers
What is the measure of (2x+94) = (8x+10)
Anna [14]
I subtract 2x  to 8x that is equal to 6x; then I subtract 10 from right to left. So 94-10 equal 84. Now you got 6x=84, divide 6 both side and you got the answer. 
 
The answer is x= 14

7 0
3 years ago
У=-3x+3<br> y = -9x + 15
julia-pushkina [17]

Answer:

(2, - 3 )

Step-by-step explanation:

Given the 2 equations

y = - 3x + 3 → (2)

y = - 9x + 15 → (2)

Substitute y = - 3x + 3 into (2)

- 3x + 3 = - 9x + 15 ( add 9x to both sides )

6x + 3 = 15 ( subtract 3 from both sides )

6x = 12 ( divide both sides by 6 )

x = 2

Substitute x = 2 into either of the 2 equations and solve for y

Substituting into (1)

y = - 3(2) + 3 = - 6 + 3 = - 3

solution is (2, - 3 )

8 0
3 years ago
Other questions:
  • A baseball stadium holds 42,000 people. The number for Saturday's attendance contains a 4 with a value 1/10 the value of the 4 i
    5·1 answer
  • What the answer for that
    7·1 answer
  • What is the common difference of an arithmetic sequence defined by the formula an=2n−4?
    12·2 answers
  • The blue line is the graph of y – 1 = x. Use the sliders to make the orange line represent 2x + y = –5. Examine the graph. What
    5·2 answers
  • Oliver saves 10% of his weekly earnings for living expenses. He usually makes $520 each week. This
    12·1 answer
  • Ciara brought $240 to spend on gifts for her family. she found 8 identical statues at the gift shop. she had $72 leftover. how m
    9·2 answers
  • Kyle throws a baseball straight up from a height of 4 feet with an initial speed of 30 feet per second. If Kyle doesn't catch th
    10·1 answer
  • Find the probability of rolling an odd number on a fair number cube and drawing a 7 of any suit from a standard deck of cards.
    8·2 answers
  • Hi , anyone can help?​
    9·2 answers
  • Anne is visiting a friend who lives 18.5 km away. She travels 10 km by
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!