# Find gcd($a,c$) with gcd($a,b$) and gcd($b,c$) is given?

Suppose gcd($a,b$) and gcd($b,c$) are given. How can we find gcd($a,c$)? (gcd($x,y$) is the greatest common divisor of $x$ and $y$). Any help is appreciated.

• It isn't determined. Try, for example, $(a,b,c)=(6,2,3)$ for which $\gcd(a,b)=2,\gcd(b,c)=1$. In this case $\gcd (a,c)=3$. But for the triple $(a,b,c)=(6,2,5)$ we also have $\gcd(a,b)=2,\gcd(b,c)=1$ but $\gcd (a,c)=1$. Or, more simply, try the two triplets $(a,b,c)=(2,3,5)$ or $(2,3,2)$. – lulu Dec 3 '16 at 11:28

For example, you can take an extreme case : Let $a = p$, let $b=1$ and let $c = p$. Then, while $\gcd(a,b) = \gcd(b,c) = 1$, it so happens that $\gcd(a,c) = p$. Taking $p$ as large enough as you want, you can see that there is no relationship at all between the suggested quantities.