0% found this document useful (0 votes)
4 views12 pages

3 the Greatest Common Divisor of Two Integer

The document discusses problem-solving techniques for finding the greatest common divisor (gcd) of two positive integers, n and m. It presents two approaches: an inefficient method that involves finding all divisors and an efficient method known as Euclid's Algorithm. The document also highlights applications of gcd, such as reducing fractions to their lowest terms.

Uploaded by

clanguage9999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

3 the Greatest Common Divisor of Two Integer

The document discusses problem-solving techniques for finding the greatest common divisor (gcd) of two positive integers, n and m. It presents two approaches: an inefficient method that involves finding all divisors and an efficient method known as Euclid's Algorithm. The document also highlights applications of gcd, such as reducing fractions to their lowest terms.

Uploaded by

clanguage9999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

PRASAD V.

POTLURI SIDDHARTHA

INSTITUTE OF TECHNOLOGY

PROBLEM SOLVING
TECHNIQUES
By

B. Vinay Kumar
Assistant Professor
Dept. of CSE
PVPSIT, Kanuru.
THE GREATEST COMMON PVPSIT (Autonomous)

DIVISOR OF TWO INTEGERS


• Problem:
• Given two positive non-zero integers n and m design an algorithm for finding their
greatest common divisor (usually abbreviated as gcd).
• Algorithm development
• Approach 1 (Not an Efficient Approach)
• It is somewhat different from other problems we have probably encountered.
• The difficult aspect of the problem involves the relationship between the divisors of
two numbers.
• Our first step might therefore be to break the problem down and find all divisors of
the two integers n and m.
• We may expect that this algorithm will be relatively time consuming for large
values ofTechniques
Problem Solving n and m. B. Vinay Kumar Monday, June 9, 2025
PVPSIT (Autonomous)

• Approach 2 (Efficient Approach) Euclid’s Algorithm


• Greek philosopher, Euclid, more than 2000 years ago proposed this.
• The gcd of two integers is the largest integer that will divide exactly into
the two numbers with no remainder.
• Example: number 30
• The divisor 5 divides the number 30 up into 6 equal parts.

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

• Example: n=30 and m=18

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025


PVPSIT (Autonomous)

• Applications
• Reducing a fraction to its lowest terms.

Problem Solving Techniques B. Vinay Kumar Monday, June 9, 2025

You might also like