{
  "id": "coprime-integers",
  "title": "Coprime Integers",
  "lang": "en",
  "source_lang": "en",
  "summary": "Coprime integers have no positive common divisor other than 1, a relationship fundamental to divisibility, fractions, and modular arithmetic.",
  "category": "mathematics",
  "subcategory": "algebra",
  "type": "concept",
  "aliases": [
    "Relatively prime integers",
    "Relatively prime numbers",
    "Coprime numbers"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/coprime-integers/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/coprime-integers/",
      "json": "https://aiwiki.page/zh/coprime-integers.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Two integers are coprime, or relatively prime, if their greatest common divisor is 1. Equivalently, no integer greater than 1 divides both of them. Coprimality describes a relationship between numbers, not a property of either number considered alone: for example, 8 and 15 are coprime even though neither is prime. The concept is fundamental in number theory, particularly in the study of divisibility, fractions, and congruences."
    },
    {
      "heading": "Definition and elementary examples",
      "text": "Integers \\(a\\) and \\(b\\) are coprime precisely when\n\n\\[\\gcd(a,b)=1.\\]\n\nThe notation \\(a\\perp b\\) is sometimes used, although writing the greatest-common-divisor condition avoids ambiguity.\n\nExamples include:\n\n- \\(8\\) and \\(15\\), whose positive divisors have only 1 in common.\n- \\(14\\) and \\(25\\), despite both numbers being composite.\n- Any two distinct prime numbers.\n- Any two consecutive integers, since a common divisor of \\(n\\) and \\(n+1\\) must divide their difference, 1.\n\nBy contrast, 14 and 21 are not coprime because their greatest common divisor is 7.\n\nSigns do not affect coprimality:\n\n\\[\\gcd(a,b)=\\gcd(|a|,|b|).\\]\n\nThus \\(-8\\) and 15 are coprime. The integers 1 and \\(-1\\) are each coprime to every integer. Since \\(\\gcd(a,0)=|a|\\), zero is coprime only to 1 and \\(-1\\). Under the usual convention \\(\\gcd(0,0)=0\\), zero is not coprime to itself.\n\nThe fundamental theorem of arithmetic gives another characterization: two nonzero integers are coprime exactly when their absolute values have no prime factor in common."
    },
    {
      "heading": "Bézout’s identity",
      "text": "A central characterization of coprimality is Bézout’s identity:\n\n\\[\\gcd(a,b)=1 \\quad\\Longleftrightarrow\\quad ax+by=1 \\quad\\text{for some integers }x,y.\\]\n\nThus two integers are coprime precisely when 1 can be expressed as an integer linear combination of them.\n\nFor example,\n\n\\[2\\cdot 8-1\\cdot 15=1,\\]\n\nwhich proves that 8 and 15 are coprime.\n\nOne direction follows immediately: if \\(ax+by=1\\), every common divisor of \\(a\\) and \\(b\\) divides the left-hand side and therefore divides 1. The reverse direction follows from the extended Euclidean algorithm, which constructs suitable coefficients \\(x\\) and \\(y\\).\n\nMore generally, if \\(d=\\gcd(a,b)\\), then there are integers \\(x,y\\) such that\n\n\\[ax+by=d.\\]\n\nConsequently, a linear Diophantine equation\n\n\\[ax+by=c,\\]\n\nwith \\(a,b\\) not both zero, has an integer solution exactly when \\(\\gcd(a,b)\\) divides \\(c\\). When \\(a\\) and \\(b\\) are coprime, every integer \\(c\\) can occur on the right-hand side."
    },
    {
      "heading": "Testing coprimality",
      "text": "The Euclidean algorithm tests coprimality without requiring prime factorization. It repeatedly applies\n\n\\[\\gcd(a,b)=\\gcd(b,a-qb)\\]\n\nuntil the remainder is zero. The last nonzero remainder is the greatest common divisor.\n\nFor example,\n\n\\[\\begin{aligned} 35&=2\\cdot12+11,\\\\ 12&=1\\cdot11+1,\\\\ 11&=11\\cdot1. \\end{aligned}\\]\n\nHence \\(\\gcd(35,12)=1\\). Substituting backward gives\n\n\\[1=12-11=12-(35-2\\cdot12)=3\\cdot12-35.\\]\n\nThe number of Euclidean division steps grows at most logarithmically with the smaller positive input. This makes greatest-common-divisor computation practical even for large integers.\n\nA basic invariance property is\n\n\\[\\gcd(a,b)=1 \\quad\\Longleftrightarrow\\quad \\gcd(a,b+ka)=1\\]\n\nfor every integer \\(k\\). Adding a multiple of one number to the other does not change their common divisors."
    },
    {
      "heading": "Several integers: collective and pairwise coprimality",
      "text": "For a finite collection \\(a_1,\\ldots,a_k\\), two distinct conditions must be distinguished.\n\nCollective coprimality means\n\n\\[\\gcd(a_1,\\ldots,a_k)=1.\\]\n\nNo integer greater than 1 divides every member of the collection.\n\nPairwise coprimality means\n\n\\[\\gcd(a_i,a_j)=1 \\quad\\text{whenever }i\\ne j.\\]\n\nEvery pair must be coprime.\n\nPairwise coprimality implies collective coprimality, but the converse fails for collections of three or more integers. For example,\n\n\\[\\gcd(6,10,15)=1,\\]\n\nyet the pairwise greatest common divisors are 2, 3, and 5. By contrast, 8, 9, and 25 are pairwise coprime.\n\nThe terms “mutually coprime” and “relatively prime” are not always used consistently for larger collections. An explicit greatest-common-divisor condition or the word “pairwise” removes ambiguity."
    },
    {
      "heading": "Divisibility consequences",
      "text": "Coprimality allows factors to be separated in divisibility arguments. An important result is Euclid’s lemma in its coprime form:\n\n\\[\\gcd(a,b)=1,\\quad a\\mid bc \\quad\\Longrightarrow\\quad a\\mid c.\\]\n\nTo see this, multiply a Bézout identity \\(ax+by=1\\) by \\(c\\):\n\n\\[acx+bcy=c.\\]\n\nBoth terms on the left are divisible by \\(a\\), so \\(c\\) is also divisible by \\(a\\).\n\nOther useful consequences include:\n\n- If \\(a\\mid c\\), \\(b\\mid c\\), and \\(a,b\\) are coprime, then \\(ab\\mid c\\).\n- If \\(a\\) is coprime to both \\(b\\) and \\(c\\), then it is coprime to \\(bc\\).\n- For positive integers \\(r,s\\),\n\n\\[\\gcd(a,b)=1 \\quad\\Longleftrightarrow\\quad \\gcd(a^r,b^s)=1.\\]\n- For positive integers \\(a,b\\),\n\n\\[\\gcd(a,b)\\operatorname{lcm}(a,b)=ab.\\]\n\nThus coprimality is equivalent to their least common multiple being \\(ab\\)."
    },
    {
      "heading": "Fractions and modular arithmetic",
      "text": "Reduced fractions\n\nA fraction \\(a/b\\), with \\(b\\ne0\\), is in lowest terms when\n\n\\[\\gcd(a,b)=1.\\]\n\nDividing numerator and denominator by their greatest common divisor produces such a representation.\n\nEvery rational number has a unique expression \\(a/b\\) with \\(b>0\\) and \\(a,b\\) coprime. The sign convention on the denominator is necessary for uniqueness.\n\nModular inverses\n\nIn modular arithmetic, an integer \\(a\\) has a multiplicative inverse modulo \\(n\\), where \\(n\\ge2\\), exactly when\n\n\\[\\gcd(a,n)=1.\\]\n\nIndeed, an inverse is an integer \\(x\\) satisfying\n\n\\[ax\\equiv1\\pmod n,\\]\n\nwhich is equivalent to an equation \\(ax+ny=1\\) for some integer \\(y\\).\n\nFor example,\n\n\\[3\\cdot12-35=1\\]\n\nshows that 3 is the inverse of 12 modulo 35.\n\nThe invertible residue classes modulo \\(n\\) form a group under multiplication. Their number is Euler’s totient function \\(\\varphi(n)\\). Euler’s theorem states that\n\n\\[a^{\\varphi(n)}\\equiv1\\pmod n\\]\n\nwhenever \\(\\gcd(a,n)=1\\).\n\nSimultaneous congruences\n\nThe Chinese remainder theorem states that congruences with pairwise coprime positive moduli have a simultaneous solution, unique modulo the product of those moduli.\n\nFor two moduli, if \\(\\gcd(m,n)=1\\), then\n\n\\[x\\equiv r\\pmod m,\\qquad x\\equiv s\\pmod n\\]\n\nhas exactly one solution class modulo \\(mn\\), regardless of the residues \\(r,s\\). Without coprimality, compatibility conditions are needed."
    },
    {
      "heading": "Frequency among positive integers",
      "text": "The proportion of ordered pairs of positive integers at most \\(N\\) that are coprime approaches\n\n\\[\\lim_{N\\to\\infty} \\frac{\\#\\{(a,b):1\\le a,b\\le N,\\ \\gcd(a,b)=1\\}}{N^2} = \\frac{6}{\\pi^2} \\approx0.607927.\\]\n\nThis limiting density is often described as the probability that two randomly chosen positive integers are coprime. Strictly speaking, there is no uniform probability distribution on all positive integers; the statement refers to independent uniform choices from \\(\\{1,\\ldots,N\\}\\), followed by the limit as \\(N\\) increases.\n\nThe result can be expressed using the Riemann zeta function:\n\n\\[\\frac{1}{\\zeta(2)} = \\prod_{p\\text{ prime}}\\left(1-\\frac1{p^2}\\right).\\]\n\nFor each prime \\(p\\), the factor excludes pairs whose two entries are both divisible by \\(p\\). A rigorous argument justifies passing from finitely many primes to the infinite product.\n\nMore generally, for \\(k\\ge2\\), the limiting proportion of ordered \\(k\\)-tuples with collective greatest common divisor 1 is \\(1/\\zeta(k)\\). This is not the density of pairwise coprime \\(k\\)-tuples when \\(k>2\\)."
    },
    {
      "heading": "Historical and algebraic context",
      "text": "Relatively prime numbers appear in Euclid’s *Elements*, where they are characterized as numbers measured by the unit alone as a common measure. The Euclidean algorithm provides the classical computational basis for determining this relationship.\n\nIn abstract algebra, Bézout’s characterization connects integer coprimality with ideals. In the ring of integers,\n\n\\[\\gcd(a,b)=1 \\quad\\Longleftrightarrow\\quad (a)+(b)=\\mathbb Z.\\]\n\nThe ideal generated by \\(a\\) and \\(b\\) is therefore the whole ring.\n\nThis formulation extends to the notion of comaximal ideals in other rings. However, the integer equivalence between having no common nonunit divisor and generating the whole ring does not hold in every ring, so generalizations of coprimality require care."
    }
  ],
  "links": [
    "integer",
    "greatest-common-divisor",
    "number-theory",
    "prime-number",
    "fundamental-theorem-of-arithmetic",
    "bezouts-identity",
    "euclidean-algorithm",
    "diophantine-equation",
    "least-common-multiple",
    "fraction",
    "rational-number",
    "modular-arithmetic",
    "eulers-totient-function",
    "chinese-remainder-theorem",
    "riemann-zeta-function",
    "euclids-elements",
    "abstract-algebra",
    "ideal-ring-theory"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}