create account

Mathematics - Number Theory - GCD and LCM by drifter1

View this thread on: hive.blogpeakd.comecency.com
· @drifter1 ·
$3.26
Mathematics - Number Theory - GCD and LCM
![](https://i.ibb.co/p0Q5gsB/tmb.jpg)

## Introduction

Hey it's a me again [@drifter1](https://peakd.com/@drifter1)!

Today we continue with **Mathematics**, and more specifically the "**Number Theory**" series, in order to get into **GCD and LCM**. The Greatest Common Divisor and Least Common Multiple are two very important numbers as they relate two (or more) integers. We already covered how the GCD can be calculated via Factorization and the Euclidean Algorithm in the 3rd part of the series. Today, we will cover the relationship between the GCD and LCM.

So, without further ado, let's dive straight into it!

* * *

## Greatest Common Divisor (GCD)

The GCD or GCF (for greatest common factor) of two (or more) integers, is the largest positive integer which perfectly divides both (or all) of them.

### Euclidean Algorithm Method

The Euclidean algorithm is maybe the most efficient way of calculating the GCD of two numbers. Basically, a division algorithm is combined with the property that the GCD has of being able to divide the difference of the two numbers.

For example, the GCD of *156* and *34* can be calculated as follows:

![](https://images.hive.blog/0x0/https://i.ibb.co/101SWMJ/example.jpg)

And so *GCD(156, 34) = 2*.

For more details on this method please check out the 3rd part of the series.

### Prime Factorization Method

In the 3rd part we also covered a more time-consuming method involving the factorization of the numbers. Any compositve (non-prime) number can be represented as a product of primes and their combinations.

Having two numbers in this representation the GCD is then simply equal to product of the common prime factors.

For example, *156* is factorized as *2<sup>2</sup> × 3 × 13* and *34* as *2 × 17*. So, as the only common prime factor is *2*, *2* is also the GCD of *156* and *34*.

* * *

## Least Common Multiple (LCM)

The LCM, which is known as the least or lowest common multiple of two (or more) integers, is the smallest positive integer which can be divided by both (or all) of the integers.

### Brute Force Method

The most basic way of finding the LCM is via a "brute force" method. Basically, all multiples of the integers are listed and in the worst case scenario the LCM will simply be the product of the two.

For example, the LCM of 16 and 30 can be checked as follows:

    16: 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240
    30: 30, 60, 90, 120, 150, 180, 210, 240

Thus, *LCM(16, 30) = 240*.

In the worst case scenario we would have to check up to *480* as *16 × 30 = 480*.

### Prime Factorization Method

Based on the factorization of two compositive numbers, the LCM is simply the product of the highest power of each of the prime numbers / factors.

For example, *16* is represented as *2<sup>4</sup>* and *30* as *2 × 3 × 5*.

Thus, the LCM of *16* and *30* is equal to *2<sup>4</sup> × 3 × 5 = 240*.

Of course, this is also quite time-consuming...

### GCD Method

Lastly, the LCM can also be calculated easily when knowing the GCD.

The following relationship holds for any two integers *a* and *b*:

    LCM (a, b) = a × b ÷ GCD (a, b)

For example, the GCD of *16* and *30* is *2*, which can easily be seen from the prime factorization. Multiplying the two numbers yields *480*. And thus the LCM is simply *480 ÷ 2 = 240*, which is the same exact result that we got via the other methods.

* * *

## Exercise

Calculate the GCD and LCM of *384* and *120* by applying the Prime Factorization Method.

**Hint**: The LCM is below *2000*. Please don't check up to *46080*.

* * *

## RESOURCES:

### References

1.  [https://brilliant.org/wiki/number-theory](https://brilliant.org/wiki/number-theory)
2.  [https://www.calculator.net/gcf-calculator.html](https://www.calculator.net/gcf-calculator.html)
3.  [https://www.calculator.net/lcm-calculator.html](https://www.calculator.net/lcm-calculator.html)

Mathematical equations used in this article, have been generated using [quicklatex](http://quicklatex.com/).

Block diagrams and other visualizations were made using [draw.io](https://app.diagrams.net/).

* * *

## Previous articles of the series

- [Introduction](https://peakd.com/hive-163521/@drifter1/mathematics-number-theory-introduction) → Number Theory, Why Number Theory, Series Outline
- [Divisibility](https://peakd.com/hive-163521/@drifter1/mathematics-number-theory-divisibility) → Divisibility, Divisibility Rules
- [Factorization and Euclidean Algorithm](https://peakd.com/hive-163521/@drifter1/mathematics-number-theory-factorization-and-euclidean-algorithm) → Factorization, Euclidean Algorithm and GCD, Division Algorithm using Calculator
- [Prime Numbers](https://peakd.com/hive-163521/@drifter1/mathematics-number-theory-prime-numbers) → Prime, Composite and Co-Prime Numbers, Prime Test (Sieve of Eratosthenes)
- [Divisibility Examples](https://peakd.com/hive-163521/@drifter1/mathematics-number-theory-divisibility-examples) → Divisibility Properties, Examples (Proof through Mathematical Induction, Properties, Solving Subproblems)

* * *

## Final words | Next up

And this is actually it for today's post!

Next time we will get into Diophantine Equations.

See ya!

![](https://steemitimages.com/0x0/https://media.giphy.com/media/ybITzMzIyabIs/giphy.gif)

Keep on drifting!

Posted with [STEMGeeks](https://stemgeeks.net)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 168 others
properties (23)
authordrifter1
permlinkmathematics-number-theory-gcd-and-lcm
categoryhive-163521
json_metadata{"tags":["mathematics","math","science","education","number","theory","gcd","lcm","method","stem"],"image":["https://i.ibb.co/p0Q5gsB/tmb.jpg","https://images.hive.blog/0x0/https://i.ibb.co/101SWMJ/example.jpg","https://steemitimages.com/0x0/https://media.giphy.com/media/ybITzMzIyabIs/giphy.gif"],"links":["https://peakd.com/@drifter1"],"app":"stemgeeks/0.1","format":"markdown","canonical_url":"https://stemgeeks.net/@drifter1/mathematics-number-theory-gcd-and-lcm"}
created2022-10-03 09:08:18
last_update2022-10-03 09:08:18
depth0
children3
last_payout2022-10-10 09:08:18
cashout_time1969-12-31 23:59:59
total_payout_value1.663 HBD
curator_payout_value1.601 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,361
author_reputation98,202,866,830,354
root_title"Mathematics - Number Theory - GCD and LCM"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id117,147,744
net_rshares4,900,239,817,974
author_curate_reward""
vote details (232)
@curation-cartel ·
$0.02
![1UP-PIZZA.png](https://files.peakd.com/file/peakd-hive/curation-cartel/23xediR4hotaNsS5pUJrmYVg3YGeTLpui41uCij2jhUDZ4uFT84zoGJf8a8VnfELXLJgt.png) |  <div class="phishy"><u><h4>You have received a __1UP__ from @gwajnberg!</h4></u></div> The @oneup-cartel will soon upvote you with:<hr> __@stem-curator__ <hr>_And they will bring !PIZZA 🍕._
-|-

<sup>[Learn more](https://peakd.com/hive-102223/@flauwy/the-curation-cartel-1up-trigger-smart-voting-mana-and-high-delegation-returns-for-14-different-tribes) about our delegation service to earn daily rewards. Join the Cartel on [Discord](https://discord.gg/mvtAneE3Ca).</sup>
👍  
properties (23)
authorcuration-cartel
permlinkre-mathematics-number-theory-gcd-and-lcm-20221003t153633z
categoryhive-163521
json_metadata"{"app": "beem/0.24.26"}"
created2022-10-03 15:36:33
last_update2022-10-03 15:36:33
depth1
children0
last_payout2022-10-10 15:36:33
cashout_time1969-12-31 23:59:59
total_payout_value0.010 HBD
curator_payout_value0.011 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length623
author_reputation1,123,281,846,602
root_title"Mathematics - Number Theory - GCD and LCM"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id117,155,449
net_rshares34,427,094,390
author_curate_reward""
vote details (1)
@gwajnberg ·
$0.02
nice class about number theories!
!1UP
<a href="https://discord.gg/zQrvxAu7mu">
<img src="https://files.peakd.com/file/peakd-hive/thecuriousfool/23wCNFDyCLJu1v77TTg2MYKkd7XWkgF9fhiLujTDAaLaUz7H4AaQkDentB5UMVS8FcrVs.png"></a>
👍  , , , ,
properties (23)
authorgwajnberg
permlinkrj6onu
categoryhive-163521
json_metadata{"tags":["stem"],"image":["https://files.peakd.com/file/peakd-hive/thecuriousfool/23wCNFDyCLJu1v77TTg2MYKkd7XWkgF9fhiLujTDAaLaUz7H4AaQkDentB5UMVS8FcrVs.png"],"links":["https://discord.gg/zQrvxAu7mu"],"app":"stemgeeks/0.1","canonical_url":"https://stemgeeks.net/@gwajnberg/rj6onu"}
created2022-10-03 15:35:54
last_update2022-10-03 15:35:54
depth1
children0
last_payout2022-10-10 15:35:54
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.011 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length224
author_reputation149,870,503,022,402
root_title"Mathematics - Number Theory - GCD and LCM"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id117,155,431
net_rshares36,660,302,598
author_curate_reward""
vote details (5)
@stemsocial ·
$0.02
re-drifter1-mathematics-number-theory-gcd-and-lcm-20221004t032001770z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.&nbsp;<br />&nbsp;<br />
</div>
👍  
properties (23)
authorstemsocial
permlinkre-drifter1-mathematics-number-theory-gcd-and-lcm-20221004t032001770z
categoryhive-163521
json_metadata{"app":"STEMsocial"}
created2022-10-04 03:20:00
last_update2022-10-04 03:20:00
depth1
children0
last_payout2022-10-11 03:20:00
cashout_time1969-12-31 23:59:59
total_payout_value0.010 HBD
curator_payout_value0.010 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,460,334,324,555
root_title"Mathematics - Number Theory - GCD and LCM"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id117,168,521
net_rshares33,393,684,329
author_curate_reward""
vote details (1)