/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q16E The algorithm for computing abmo... [FREE SOLUTION] | 91影视

91影视

The algorithm for computing abmodCby repeated squaring does not necessarily lead to the minimum number of multiplications. Give an example of b>10where the exponentiation can be performed using fewer multiplications, by some other method.

Short Answer

Expert verified

The new method is performed by using fewer multiplications than the given algorithm.

Step by step solution

01

Introduction 

Example for exponentiation:

Consider the value of b is 15

The repeated squaring algorithm calculates the value b15 by following method:

a15=a*a2*a4*a8

In the above calculation,

a2鈥 is having one multiplication (i.e.a2=aa ).

a4鈥 is having one multiplication (i.e.a4=a2a2).

a8鈥 is having one multiplication (i.e. a8=a4a4).

The expression 鈥aa2a4a8鈥 has three multiplications.

Therefore, the above method takes totally 6 multiplications.

02

Data step

Other method for exponentiation:

Consider the value 鈥渂 鈥 is 鈥15 鈥.

Split the value 鈥 15 鈥 into 鈥 3 6 , and 12 鈥.

Initially, find 鈥a3=a*a*a 鈥.

This step contains two multiplications process.

Find 鈥a6=a3*a3 鈥.

This step contains one multiplication process.

And find 鈥a12=a6*a6 鈥.

This step contains one multiplication process.

Then finally, 鈥a15鈥 can be calculated by the following:

a15=a12*a3

The above step contains one multiplication process.

Thus, the above method takes a totally5 multiplications.

Therefore, the new method is performed by using fewer multiplications than the given algorithm.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91影视!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

What is 222006(mod3)?

Prove or disprove: If a has an inverse modulo b, then b has an inverse modulo a.

The grade-school algorithm for multiplying two n-bit binary numbers x and y consist of addingtogethern copies of r, each appropriately left-shifted. Each copy, when shifted, is at most 2n bits long.
In this problem, we will examine a scheme for adding n binary numbers, each m bits long, using a circuit or a parallel architecture. The main parameter of interest in this question is therefore the depth of the circuit or the longest path from the input to the output of the circuit. This determines the total time taken for computing the function.
To add two m-bit binary numbers naively, we must wait for the carry bit from position i-1before we can figure out the ith bit of the answer. This leads to a circuit of depth(m). However, carry-lookahead circuits (see
wikipedia.comif you want to know more about this) can add in(logn)depth.

  1. Assuming you have carry-lookahead circuits for addition, show how to add n numbers eachm bits long using a circuit of depth (lognlogm).
  2. When adding three m-bit binary numbers x+y+z, there is a trick we can use to parallelize the process. Instead of carrying out the addition completely, we can re-express the result as the sum of just two binary numbersr+s, such that the ith bits of r and s can be computedindependently of the other bits. Show how this can be done. (Hint: One of the numbers represents carry bits.)
  3. Show how to use the trick from the previous part to design a circuit of depth(logn)for multiplying two n-bit numbers.

Give a polynomial-time algorithm for computing,abcmodp given a,b,c, and prime p.

Calculate 2125mod127using any method you choose. (Hint: 127 is prime.)

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.