Questions tagged [gcd-and-lcm]

For questions related to gcd (greatest common divisor, also known as the hcf, the highest common factor), 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$.


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

2686 questions
0
votes
0 answers

Maximum Pairwise GCD from an even subsequence of an array

I am trying to solve a particular problem, where I have been given an array of integers and an integer X and I need to obtain the maximum pairwise gcd from a subsequence of the array given that the size of the subsequence must not exceed 2*X. So for…
0
votes
1 answer

"Factor" a number into 1-16 products and sum parts

I have a number N (integer 32 bits) that I need to "factor" into 1-16 product and sum parts. Let me explain: For $N = 256$, I want: $(16 \times 16)$ For $N = 257$, I want: $(16 \times 16) + 1$ For $N = 512$, I want: $(16 \times 16) \times 2$ For $N…
0
votes
1 answer

Prove that if $a,m,n \in \mathbb{Z}^+$ and $m \ne n$ then $\gcd(a^{2^m}+1,a^{2^n}+1)$ is 1 if a is even and 2 if a is odd.

I know that if a pime q|a^2^m+1 and q divides a^2^n+1 then q divides their sum and difference but i don't know how to proceed further. please help
0
votes
3 answers

How do we find greatest common divisor of 24 and 6?

How do we find that $GCD(24,6) = 6$ ? When i tried to use the "Euclidean algorithm" I got $24 = 6*4 + 0$
0
votes
1 answer

I need an opinion and maybe a clarification about my work on the following problem:

Problem: Suppose that $m_1,m_2,...,m_t$ are positive integers and $a_1,a_2,...,a_t$ are integers. What condition on $m_1,m_2,...,m_t$ is necessary to guarantee that there is an integer x such that $x ≡ a_i $ mod $m_i$ for all intergers i in the…
Valentin
  • 147
0
votes
1 answer

Which is the gcd of 2 numbers which are multiplied and the result is 600000?

When 2 numbers are multiplied the result is 600000.Which is the greatest common divisor? I think it might be 200.but also might be number 1.Can you help me please?
Lyds
  • 41
0
votes
1 answer

Bezout's identity: which half is larger?

Bezout's identity: Let a and b be integers with greatest common divisor d. Then, there exist integers x and y such that ax + by = d. Is it true that if a > b then ax < by? Is there a proof for this?
0
votes
1 answer

Finding a greatest common divisor

Find a GCD of number $A_0,A_1,\cdots,A_{2013}$ if $A_n=2^{3n}+3^{6n+2}+5^{6n+2}$ where $n=0,1,\cdots,2013$ I have no idea can you help me. Only what I can see that they have the same degree $3n$ and $5=3+2$ but I do not know can that help me…
0
votes
5 answers

Is it true that $\gcd(a,b)$ = $\gcd(a,bk)$ for some integer k?

Does it always hold true that $\gcd(a,b)$ = $\gcd(a,bk)$ for some integer k? I can't necessarily find a counter example.
Wallace
  • 436
0
votes
1 answer

Common Denominators, What is A + B

I've found the common denominators and then played around with the stuff in the numerator, but the question asks specifically $A + B$. Is that even possible to find since we have A - B on the left hand side? So I got $A(x+2) - B(x-3) = 3x +…
JCase
  • 41
0
votes
3 answers

GCD of two big numbers

How to find $gcd(5^{100}-1, 5^{120}-1)$? The problem is numbers are really big ($5^{100}$ is 70 digits). None of the numbers is prime. I ran Euclid's algorithm on Python and found the answer in less than a second, however it seems that there is no…
0
votes
1 answer

How can I prove $\gcd(10^{a-1}+10^{a-2}+\cdots+1, 10^{b-1}+10^{b-2}+\cdots+1)=10^{\gcd(a,b)-1}+10^{\gcd(a,b)-2}+\cdots+1$?

I was solving $\gcd$ algorithm problem. The problem was to get a $\gcd$ from two special numbers. Followings are conditions. 1) User can input number $a$ and $b$ (maximum ciphers of a,b is 19. so type is must be unsinged long long 2) Two special…
BAE HA RAM
  • 103
  • 5
0
votes
2 answers

What is $|\{n\in N:n\mid p^2q\}|$?

$$|\{n\in N:n\mid p^2q\}|$$ $p$ is an odd prime number, $q$ is a prime number and $p$ does not equal $q$. I dont understand what they're asking me to find, is it to find a value of $n$ that divides into $p^2q$? I need all the help i can get here,…
user522473
0
votes
2 answers

Prove that if $\gcd(m, n) > 1$, then there do not exist integers $x, y$ so that $mx + ny = 1$.

I've been stuck on this one for awhile, and I thought that if I did a contradiction: if $\gcd(m,n) > 1$ then for all integers $x,y$, $ax + ny \neq 1$. I could simply prove it wrong by giving an example. But I've got a feeling that I'm missing…
AY99
  • 9
0
votes
0 answers

Why can't be a number the gcd of two numbers?

I have the ring $R = \mathbb{Z[i\sqrt{3}]}$, and I need to find the gcd of $a = 6+2i\sqrt{3}, b = 4-2i\sqrt{3}$. This is the way I solved it: Let $d = x+yi\sqrt{3}$ be $gcd(a,b)$ then $d |a$ and $d|b$ and also $N(d)|N(a) = 48$ and $N(d)|N(b) = 28$…