Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

(a) Show that if \({a_1},{a_2},\, \cdots ,\,{a_n}\) are positive integers then\(gcd\left( {{a_1},{a_2},\, \cdots ,\,{a_{n - 1}},\,{a_n}} \right) = gcd\left( {{a_1},{a_2},\, \cdots {a_{n - 2}},\,gcd\left( {{a_{n - 1}},\,{a_n}} \right)} \right)\).

(b) Use part (a), together with the Euclidean algorithm, to develop a recursive algorithm for computing the greatest common divisor of a set of \(n\) positive integers.

Short Answer

Expert verified

(a) We proved that \(\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 1}},\,{a_n}\,} \right) = \gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\,} \right)\)

(b)Greatest common divisor is computed by recursive algorithm using Euclidean algorithm.

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

Over 22 million students worldwide already upgrade their learning with Vaia!

01

To recall definition of Greatest common divisor

Greatest Common Divisor (GCD):

An integer\(d\)is said to be the greatest common divisor of two integers\(a\)and\(b\)if –

1)\(d|a,\,d|b\)

2) If \(c|a,\,c|b\), then \(c \le d\), for all integers \(c\).

02

(a) To prove \(gcd\left( {{a_1},{a_2},\, \cdots ,\,{a_{n - 1}},\,{a_n}} \right) = gcd\left( {{a_1},{a_2},\, \cdots {a_{n - 2}},\,gcd\left( {{a_{n - 1}},\,{a_n}} \right)} \right)\)

Let, \(d = \gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 1}},\,{a_n}\,} \right)\).

This implies that \(d\) is the divisor of \({a_1},\,{a_2},\, \ldots ,\,{a_{n - 1}},\,{a_n}\).

This also implies that \(d\) is the divisor of \(\left( {{a_{n - 1}},\,{a_n}} \right)\) since \(d|{a_{n - 1}}\) and \(d|{a_n}\).

Thus, \(d\) is the divisor of \(\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\,} \right)\) since \(d\) divides \({a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\).

Then \(\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 1}},\,{a_n}\,} \right) \le \gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\,} \right)\,\)…….. (1)

Let, \(b = \gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\,} \right)\).

This implies that \(b\) is the divisor of \({a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\).

Since we have

\(\begin{aligned}{l}b|\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\\ \Rightarrow b|{a_{n - 1}},\,b|{a_n}\end{aligned}\)

This also implies that

\(b|\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\,} \right)\)since \(b|{a_1},\,{a_2},\, \ldots ,\,{a_n}\).

Therefore, \(\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 1}},\,{a_n}\,} \right) \ge \gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\,} \right)\)…….. (2)

From (1) and (2), we get,

\(\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 1}},\,{a_n}\,} \right) = \gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 2}},\,\gcd \left( {{a_{n - 1}},\,{a_n}} \right)\,} \right)\).

03

(b) To develop a recursive algorithm

We call the algorithm the “gcd” and the input is the list of \(n\) positive integers with \(n \ge 2\).

Procedure: \(\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_n}:n \ge 2} \right)\).

If \(n = 2\), then input contains only two integers.

Using Euclidean algorithm we will determine the greatest common divisor of two integers.

if n=2 then

return Euclidean \(\left( {{a_1},\,{a_2}} \right)\)

If \(n > 2\), then we use the result of part (a) to determine the greatest common divisor.

else

\({a_{n - 1}}\): Euclidean \(\left( {{a_{n - 1}},\,{a_n}} \right)\)

return \(\gcd \left( {{a_1},\,{a_2},\, \ldots ,\,{a_{n - 1}}} \right)\)

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

Prove that the first player has a winning strategy for the game of Chomp, introduced in Example 12 in Section 1.8, if the initial board is two squares wide, that is, a2×n board. [Hint: Use strong induction. The first move of the first player should be to Chomp the cookie in the bottom row at the far right.]

In the proof of Lemma 1 we mentioned that many incorrect methods for finding a vertex such that the line segment is an interior diagonal of have been published. This exercise presents some of the incorrect ways has been chosen in these proofs. Show, by considering one of the polygons drawn here, that for each of these choices of , the line segment is not necessarily an interior diagonal of .

a) p is the vertex of P such that the angleabpis smallest.

b) p is the vertex of P with the least -coordinate (other than ).

c) p is the vertex of P that is closest to .

There are infinitely many stations on a train route. Sup-

pose that the train stops at the first station and suppose that if the train stops at a station, then it stops at the next station. Show that the train stops at all stations.

Use strong induction to show that every positive integer n can be written as a sum of distinct powers of two, that is, as a sum of subset of the integers20=1,21=2,22=4, and so on. [Hint: For the inductive step, separately consider the case wherek+1 is even and where it is odd. When it is even, note that(k+1)/2 is an integer.]

Prove that n27n+12is nonnegative whenever n is an integer with n3

See all solutions

Recommended explanations on Math 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.

Sign-up for free