Questions tagged [gcd-and-lcm]

Use for questions related to gcd (greatest common divisor), lcm (least common multiple), and related concepts from integer and ring theory.

The greatest common divisor (also known as highest common factor) of two or more integers is the largest integer that divides all of them. It may be computed using the Euclidean algorithm.

Bézout's identity states that for non-zero integers $a$ and $b$ there exist integers $x$ and $y$ with $ax+by=\gcd(a,b)$.


If $a, b \in \mathbb{N}$, write $a \mid b$ if $a$ divides $b$, i.e. there is $k \in \mathbb{N}$ such that $b = ka$.

The least (or lowest) common multiple of $a_1, \dots, a_k \in \mathbb{N}$ is the smallest positive integer $N$ such that $a_i \mid N$ for $i = 1, \dots, k$. We usually denote $N$ by $\operatorname{lcm}(a_1, \dots, a_k)$. Note that $\operatorname{lcm}(a_1, \dots, a_k)$ can be defined recursively from a binary definition. That is,

$$\operatorname{lcm}(a_1, \dots, a_k) = \operatorname{lcm}(\operatorname{lcm}(\dots\operatorname{lcm}(\operatorname{lcm}(a_1, a_2), a_3), \dots, a_{k-1}), a_k).$$

If $a, b \in \mathbb{N}$ and $a = p_1^{r_1}\dots p_m^{r_m}$, $b = p_1^{s_1}\dots p_m^{s_n}$ are their prime decompositions (where some of the $r_i$ and $s_j$ can be zero), we have

$$\operatorname{lcm}(a, b) = p_1^{\max(r_1, s_1)}\dots\ p_m^{\max(r_m, s_m)}.$$

Note that $\operatorname{lcm}(a, b)\operatorname{gcd}(a, b) = ab$.


All of these notions can be generalised to any commutative ring; the above is just the particular case of (positive elements of) the ring $\mathbb{Z}$.

2391 questions
168
votes
9 answers

Prove that $\gcd(a^n - 1, a^m - 1) = a^{\gcd(n, m)} - 1$

For all $a, m, n \in \mathbb{Z}^+$, $$\gcd(a^n - 1, a^m - 1) = a^{\gcd(n, m)} - 1$$
Juan Liner
85
votes
5 answers

How to use the Extended Euclidean Algorithm manually?

I've only found a recursive algorithm of the extended Euclidean algorithm. I'd like to know how to use it by hand. Any idea?
84
votes
8 answers

What is $\gcd(0,0)$?

What is the greatest common divisor of $0$ and $0$? On the one hand, Wolfram Alpha says that it is $0$; on the other hand, it also claims that $100$ divides $0$, so $100$ should be a greater common divisor of $0$ and $0$ than $0$.
50
votes
6 answers

Order of elements is lcm-closed in abelian groups

How can I prove that if $G$ is an Abelian group with elements $a$ and $b$ with orders $m$ and $n$, respectively, then $G$ contains an element whose order is the least common multiple of $m$ and $n$? It's an exercise from Hungerford's book, but it's…
45
votes
5 answers

Prove that any two consecutive terms of the Fibonacci sequence are relatively prime

Prove that any two consecutive terms of the Fibonacci sequence are relatively prime. My attempt: We have $f_1 = 1, f_2 = 1, f_3 = 2, \dots$, so obviously $\gcd(f_1, f_2) = 1$. Suppose that $\gcd(f_n, f_{n+1}) = 1$; we will show that…
43
votes
1 answer

Investigating the recurrence relation $x_{n+1}=\frac{x_{n}+x_{n-1}}{(x_{n},\,x_{n-1})}+1$

Let $x_{n} \in \mathbb Z$ be the $n$-th term of the recurrence relation $$ x_{n+1} = \frac{x_{n} + x_{n-1}}{(x_{n},x_{n-1})} + 1$$ where $(x_{n},x_{n-1})$ is the gcd of $x_{n}$ and $x_{n-1}$. Some examples: $1, 1, 3, 5, 9, 15, 9, 9, 3, 5, 9,…
42
votes
8 answers

Why $\gcd(b,qb+r)=\gcd(b,r),\,$ so $\,\gcd(b,a) = \gcd(b,a\bmod b)$

Given: $a = qb + r$. Then it holds that $\gcd(a,b)=\gcd(b,r)$. That doesn't sound logical to me. Why is this so? Addendum by LePressentiment on 11/29/2013: (in the interest of http://meta.math.stackexchange.com/a/4110/53259 and averting a…
37
votes
11 answers

Is this $\gcd(0, 0) = 0$ a wrong belief in mathematics or it is true by convention?

I'm sorry to ask this question but it is important for me to know more about number theory. I'm confused how $0$ is not divided by itself and in Wolfram Alpha $\gcd(0, 0) = 0$ . My question here is: is $\gcd(0, 0) = 0$ a wrong belief in mathematics…
35
votes
7 answers

How can one talk about gcd in the context of complex numbers where order doesn't exist?

I was reading this: GCD of gaussian integers but the thing that we are calculating, the GCD, doesn't make any sense in the complex number world since there is no ordering of numbers there. So, how can we define and calculate the GCD there?
31
votes
5 answers

Fibonacci divisibilty properties $ F_n\mid F_{kn},\,$ $\, \gcd(F_n,F_m) = F_{\gcd(n,m)}$

Can any one give a generalization of the following properties in a single proof? I have checked the results, which I have given below by trial and error method. I am looking for a general proof, which will cover the all my results below: Every…
30
votes
2 answers

How to calculate GCD of Gaussian integers?

Let $\mathbb Z [i] =\{a+bi: a,b \in \mathbb Z\}$. What is the gcd of $11+7i$ and $18-i$ in $\mathbb Z [i]$?
Mohan
  • 13,820
  • 17
  • 72
  • 125
29
votes
4 answers

If $a \mid m$ and $(a + 1) \mid m$, prove $a(a + 1) | m$.

Can anyone help me out here? Can't seem to find the right rules of divisibility to show this: If $a \mid m$ and $(a + 1) \mid m$, then $a(a + 1) \mid m$.
KaliKelly
28
votes
1 answer

Proof that the ratio between the logs of the product and LCM of the Fibonacci numbers converges to $\frac{\pi^2}{6}$

I came across this amazing fact on Twitter. $$\lim_{n\to\infty} \frac{\log\left(F_1 \cdots F_n\right)}{\log \text{LCM}\left(F_1, \ldots, F_n\right)} = \frac{\pi^2}{6}$$ where $F_i$ is the $i$th Fibonacci number and LCM = Least Common Multiple. This…
28
votes
4 answers

What is $\gcd(0,a)$, where $a$ is a positive integer?

I have tried $\gcd(0,8)$ in a lot of online gcd (or hcf) calculators, but some say $\gcd(0,8)=0$, some other gives $\gcd(0,8)=8$ and some others give $\gcd(0,8)=1$. So really which one of these is correct and why there are different conventions?
26
votes
6 answers

Prove $\gcd(a+b, a-b) = 1$ or $2\,$ if $\,\gcd(a,b) = 1$

I want to show that for $\gcd(a,b) = 1$ $a,b \in Z$ $\gcd(a+b, a-b) = 1$ or $\gcd(a+b, a-b) = 2$ holds. I think the first step should look something like this: $d = \gcd(a+b, a-b) = \gcd(2a, a-b)$ From here I tried to proceed with two cases. 1:…
Woltan
  • 363
  • 1
  • 3
  • 6
1
2 3
99 100