Hubbry Logo
Coprime integersCoprime integersMain
Open search
Coprime integers
Community hub
Coprime integers
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Coprime integers
Coprime integers
from Wikipedia

In number theory, two integers a and b are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1.[1] Consequently, any prime number that divides a does not divide b, and vice versa. This is equivalent to their greatest common divisor (GCD) being 1.[2] One says also a is prime to b or a is coprime with b.

The numbers 8 and 9 are coprime, despite the fact that neither—considered individually—is a prime number, since 1 is their only common divisor. On the other hand, 6 and 9 are not coprime, because they are both divisible by 3. The numerator and denominator of a reduced fraction are coprime, by definition.

Notation and testing

[edit]

When the integers a and b are coprime, the standard way of expressing this fact in mathematical notation is to indicate that their greatest common divisor is one, by the formula gcd(a, b) = 1 or (a, b) = 1. In their 1989 textbook Concrete Mathematics, Ronald Graham, Donald Knuth, and Oren Patashnik proposed an alternative notation to indicate that a and b are relatively prime and that the term "prime" be used instead of coprime (as in a is prime to b).[3]

A fast way to determine whether two numbers are coprime is given by the Euclidean algorithm and its faster variants such as binary GCD algorithm or Lehmer's GCD algorithm.

The number of integers coprime with a positive integer n, between 1 and n, is given by Euler's totient function, also known as Euler's phi function, φ(n).

A set of integers can also be called coprime if its elements share no common positive factor except 1. A stronger condition on a set of integers is pairwise coprime, which means that a and b are coprime for every pair (a, b) of different integers in the set. The set {2, 3, 4} is coprime, but it is not pairwise coprime since 2 and 4 are not relatively prime.

Properties

[edit]

The numbers 1 and −1 are the only integers coprime with every integer, and they are the only integers that are coprime with 0.

A number of conditions are equivalent to a and b being coprime:

As a consequence of the third point, if a and b are coprime and brbs (mod a), then rs (mod a).[5] That is, we may "divide by b" when working modulo a. Furthermore, if b1, b2 are both coprime with a, then so is their product b1b2 (i.e., modulo a it is a product of invertible elements, and therefore invertible);[6] this also follows from the first point by Euclid's lemma, which states that if a prime number p divides a product bc, then p divides at least one of the factors b, c.

As a consequence of the first point, if a and b are coprime, then so are any powers ak and bm.

If a and b are coprime and a divides the product bc, then a divides c.[7] This can be viewed as a generalization of Euclid's lemma.

Figure 1. The numbers 4 and 9 are coprime. Therefore, the diagonal of a 4 × 9 lattice does not intersect any other lattice points

The two integers a and b are coprime if and only if the point with coordinates (a, b) in a Cartesian coordinate system would be "visible" via an unobstructed line of sight from the origin (0, 0), in the sense that there is no point with integer coordinates anywhere on the line segment between the origin and (a, b). (See figure 1.)

In a sense that can be made precise, the probability that two randomly chosen integers are coprime is 6/π2, which is about 61% (see § Probability of coprimality, below).

Two natural numbers a and b are coprime if and only if the numbers 2a − 1 and 2b − 1 are coprime.[8] As a generalization of this, following easily from the Euclidean algorithm in base n > 1:

Coprimality in sets

[edit]

A set of integers can also be called coprime or setwise coprime if the greatest common divisor of all the elements of the set is 1. For example, the integers 6, 10, 15 are coprime because 1 is the only positive integer that divides all of them.

If every pair in a set of integers is coprime, then the set is said to be pairwise coprime (or pairwise relatively prime, mutually coprime or mutually relatively prime). Pairwise coprimality is a stronger condition than setwise coprimality; every pairwise coprime finite set is also setwise coprime, but the reverse is not true. For example, the integers 4, 5, 6 are (setwise) coprime (because the only positive integer dividing all of them is 1), but they are not pairwise coprime (because gcd(4, 6) = 2).

The concept of pairwise coprimality is important as a hypothesis in many results in number theory, such as the Chinese remainder theorem.

It is possible for an infinite set of integers to be pairwise coprime. Notable examples include the set of all prime numbers, the set of elements in Sylvester's sequence, and the set of all Fermat numbers.

Probability of coprimality

[edit]

Given two randomly chosen integers a and b, it is reasonable to ask how likely it is that a and b are coprime. In this determination, it is convenient to use the characterization that a and b are coprime if and only if no prime number divides both of them (see Fundamental theorem of arithmetic).

Informally, the probability that any number is divisible by a prime (or in fact any integer) p is for example, every 7th integer is divisible by 7. Hence the probability that two numbers are both divisible by p is and the probability that at least one of them is not is Any finite collection of divisibility events associated to distinct primes is mutually independent. For example, in the case of two events, a number is divisible by primes p and q if and only if it is divisible by pq; the latter event has probability If one makes the heuristic assumption that such reasoning can be extended to infinitely many divisibility events, one is led to guess that the probability that two numbers are coprime is given by a product over all primes,

Here ζ refers to the Riemann zeta function, the identity relating the product over primes to ζ(2) is an example of an Euler product, and the evaluation of ζ(2) as π2/6 is the Basel problem, solved by Leonhard Euler in 1735.

There is no way to choose a positive integer at random so that each positive integer occurs with equal probability, but statements about "randomly chosen integers" such as the ones above can be formalized by using the notion of natural density. For each positive integer N, let PN be the probability that two randomly chosen numbers in are coprime. Although PN will never equal 6/π2 exactly, with work[9] one can show that in the limit as the probability PN approaches 6/π2.

More generally, the probability of k randomly chosen integers being setwise coprime is

Generating all coprime pairs

[edit]
The tree rooted at (2, 1). The root (2, 1) is marked red, its three children are shown in orange, third generation is yellow, and so on in the rainbow order.

All pairs of positive coprime numbers (m, n) (with m > n) can be arranged in two disjoint complete ternary trees, one tree starting from (2, 1) (for even–odd and odd–even pairs),[10] and the other tree starting from (3, 1) (for odd–odd pairs).[11] The children of each vertex (m, n) are generated as follows:

  • Branch 1:
  • Branch 2:
  • Branch 3:

This scheme is exhaustive and non-redundant with no invalid members. This can be proved by remarking that, if is a coprime pair with then

  • if then is a child of along branch 3;
  • if then is a child of along branch 2;
  • if then is a child of along branch 1.

In all cases is a "smaller" coprime pair with This process of "computing the father" can stop only if either or In these cases, coprimality, implies that the pair is either or

Another (much simpler) way to generate a tree of positive coprime pairs (m, n) (with m > n) is by means of two generators and , starting with the root . The resulting binary tree, the Calkin–Wilf tree, is exhaustive and non-redundant, which can be seen as follows. Given a coprime pair one recursively applies or depending on which of them yields a positive coprime pair with m > n. Since only one does, the tree is non-redundant. Since by this procedure one is bound to arrive at the root, the tree is exhaustive.

Applications

[edit]

In machine design, an even, uniform gear wear is achieved by choosing the tooth counts of the two gears meshing together to be relatively prime. When a 1:1 gear ratio is desired, a gear relatively prime to the two equal-size gears may be inserted between them.

In pre-computer cryptography, some Vernam cipher machines combined several loops of key tape of different lengths. Many rotor machines combine rotors of different numbers of teeth. Such combinations work best when the entire set of lengths are pairwise coprime.[12][13][14][15]

Generalizations

[edit]

This concept can be extended to other algebraic structures than for example, polynomials whose greatest common divisor is 1 are called coprime polynomials.

Coprimality in ring ideals

[edit]

Two ideals A and B in a commutative ring R are called coprime (or comaximal) if This generalizes Bézout's identity: with this definition, two principal ideals (a) and (b) in the ring of integers are coprime if and only if a and b are coprime. If the ideals A and B of R are coprime, then furthermore, if C is a third ideal such that A contains BC, then A contains C. The Chinese remainder theorem can be generalized to any commutative ring, using coprime ideals.

See also

[edit]

Notes

[edit]

References

[edit]

Further reading

[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
In number theory, two integers aa and bb are defined as coprime, or relatively prime, if their greatest common divisor is 1, meaning they share no common prime factors other than 1. This property holds if and only if there are no integers greater than 1 that divide both aa and bb, and it applies to any pair of integers, including negatives and zero (with the convention that gcd(0,0) is undefined but gcd(a,0)=|a| for a ≠ 0). Examples include 8 and 15 (gcd=1) or 21 and 22 (gcd=1), but not 12 and 18 (gcd=6). The concept of coprime integers is foundational to many theorems in elementary . Bézout's identity asserts that if aa and bb are coprime, then there exist integers xx and yy such that ax+by=1ax + by = 1, providing a that generates the gcd. This extends to the more general case where gcd(a,ba,b)=d, allowing ax+by=dax + by = d. follows as a consequence: if a prime pp divides the product abab and pp is coprime to aa, then pp must divide bb; this is key to proving the fundamental theorem of arithmetic on unique prime factorization. Coprime integers also play a central role in modular arithmetic and cryptographic applications. Euler's theorem states that if aa and nn are coprime, then aϕ(n)1(modn)a^{\phi(n)} \equiv 1 \pmod{n}, where ϕ(n)\phi(n) is Euler's totient function counting the integers from 1 to n1n-1 that are coprime to nn; for primes pp, this reduces to Fermat's Little Theorem with ϕ(p)=p1\phi(p) = p-1. In the RSA cryptosystem, the public exponent ee is selected to be coprime to ϕ(n)\phi(n) (where n=pqn = pq for distinct primes pp and qq), ensuring ee has a modular inverse modulo ϕ(n)\phi(n) for decryption. Additionally, Dirichlet's theorem guarantees infinitely many primes in any arithmetic progression a+kda + kd where aa and d>0d > 0 are coprime.

Definition and Basic Concepts

Definition of Coprimality

Two integers aa and bb are said to be coprime, or relatively prime, if their gcd(a,b)\gcd(a, b) equals 1. The of aa and bb is the largest positive that divides both without remainder. This condition implies that aa and bb share no common prime factors other than possibly 1, ensuring they have no nontrivial common divisors. Although the definition applies to all integers, discussions of coprimality often focus on positive integers for simplicity, as the gcd is invariant under signs: gcd(a,b)=gcd(a,b)\gcd(a, b) = \gcd(|a|, |b|). Special care is needed for zero; gcd(0,n)=n\gcd(0, n) = |n| for any integer n0n \neq 0, so 0 and nn are coprime only if n=1|n| = 1. Thus, 0 is coprime with 1 and -1, but not with any other integer. The concept originates in Euclid's Elements (circa 300 BCE), where relatively prime numbers are defined in Book VII, Definition 12 as those "measured by a unit alone as a common measure." This foundational idea underpins the unique of integers into primes, as coprimality guarantees that factorizations do not share common elements beyond unity. For example, 8 and 15 are coprime because gcd(8,15)=1\gcd(8, 15) = 1, as 8 factors as 232^3 and 15 as 3×53 \times 5, with no shared prime factors.

Notation and Testing

Two integers aa and bb are denoted as coprime if their satisfies (a,b)=1(a, b) = 1, where (a,b)(a, b) is the standard notation for the gcd. An alternative symbol in some texts is aba \perp b, employing the perpendicularity notation to signify that no prime divides both aa and bb. In and programming libraries, such as those in symbolic algebra systems, a predicate like RelPrime(a, b) may return true if the pair is coprime. The primary method to test coprimality is the , which efficiently computes gcd(a,b)\gcd(a, b) for integers a>b>0a > b > 0. The algorithm proceeds recursively: gcd(a,b)=gcd(b,amodb)\gcd(a, b) = \gcd(b, a \mod b), continuing until the remainder is zero, at which point the non-zero remainder is the gcd; if this value is 1, then aa and bb are coprime. This process relies on the property that the gcd remains unchanged under replacement of the larger number by its remainder when divided by the smaller. The has a of O(logmin(a,b))O(\log \min(a, b)), as each step roughly halves the size of the numbers involved, leading to at most a logarithmic number of divisions. For verification purposes, the augments the basic version by tracking coefficients to express the gcd as a : it finds integers ss and tt such that as+bt=gcd(a,b)as + bt = \gcd(a, b); when the gcd is 1, this confirms coprimality via . Consider the example of testing gcd(48,35)\gcd(48, 35): 48=135+13,35=213+9,13=19+4,9=24+1,4=41+0.\begin{align*} 48 &= 1 \cdot 35 + 13, \\ 35 &= 2 \cdot 13 + 9, \\ 13 &= 1 \cdot 9 + 4, \\ 9 &= 2 \cdot 4 + 1, \\ 4 &= 4 \cdot 1 + 0. \end{align*} The last non-zero remainder is 1, so gcd(48,35)=1\gcd(48, 35) = 1, confirming that 48 and 35 are coprime.

Properties of Coprime Integers

Arithmetic Properties

A fundamental arithmetic property of coprime integers is their invariance under addition multiples. Specifically, if gcd(a,b)=1\gcd(a, b) = 1, then gcd(a+kb,b)=1\gcd(a + k b, b) = 1 for any integer kk. This follows from the general relation gcd(a+kb,b)=gcd(a,b)\gcd(a + k b, b) = \gcd(a, b), which holds because any common divisor of a+kba + k b and bb also divides a=(a+kb)kba = (a + k b) - k b, and conversely, any common divisor of aa and bb divides a+kba + k b. Bézout's identity provides a characterization of coprimality in terms of linear combinations. It states that two integers aa and bb are coprime there exist integers xx and yy such that ax+by=1a x + b y = 1. More generally, for any integers aa and bb not both zero, there exist integers xx and yy such that ax+by=gcd(a,b)a x + b y = \gcd(a, b). The proof is constructive and relies on the , which back-substitutes the steps of the to express the gcd as such a combination, though the explicit steps are omitted here. A key consequence is that the set of all linear combinations ax+bya x + b y, where xx and yy range over the , consists precisely of the multiples of gcd(a,b)\gcd(a, b). Thus, when aa and bb are coprime, these linear combinations generate all , meaning the ideal generated by aa and bb in the is the entire ring [Z](/page/Z)\mathbb{[Z](/page/Z)}. For example, the equation 15x+28y=115x + 28y = 1 has solutions, such as x=13x = -13 and y=7y = 7, since 15(13)+28(7)=195+196=115(-13) + 28(7) = -195 + 196 = 1. In contrast, if aa and bb are not coprime, with gcd(a,b)=d>1\gcd(a, b) = d > 1, then dd divides every ax+bya x + b y, including a+ba + b. Consequently, gcd(a+b,b)=d>1\gcd(a + b, b) = d > 1, illustrating how non-coprimality propagates under .

Multiplicative Properties

One fundamental multiplicative property of coprimality is its preservation under multiplication: if gcd(a,b)=1\gcd(a, b) = 1 and gcd(a,c)=1\gcd(a, c) = 1, then gcd(a,bc)=1\gcd(a, bc) = 1. This follows from the fact that any common of aa and bcbc must divide bb and cc separately, but since aa shares no common factors with either, the gcd remains 1. A more general result is the multiplicative formula for the gcd: if gcd(a,b)=1\gcd(a, b) = 1, then gcd(ab,c)=gcd(a,c)gcd(b,c)\gcd(ab, c) = \gcd(a, c) \cdot \gcd(b, c). For example, if a=2a=2, b=3b=3, and c=6c=6, then gcd(2,3)=1\gcd(2,3)=1 and gcd(6,6)=6=gcd(2,6)gcd(3,6)=23\gcd(6,6)=6 = \gcd(2,6) \cdot \gcd(3,6) = 2 \cdot 3. This property highlights how coprimality allows the gcd to "distribute" over without interference from shared factors. Coprimality is intimately connected to the unique factorization theorem, which states that every greater than 1 has a unique prime up to ordering. Two s are coprime they share no common prime factors in their factorizations. For instance, distinct primes pp and qq are coprime, so pqpq has the distinct prime factors pp and qq with multiplicity one each. This coprimality condition is a prerequisite for in : if gcd(a,n)=1\gcd(a, n) = 1, then aϕ(n)1(modn)a^{\phi(n)} \equiv 1 \pmod{n}, where ϕ\phi is .

Coprimality in Sets

Pairwise and Mutual Coprimality

In , a finite set of integers {a1,a2,,ak}\{a_1, a_2, \dots, a_k\} with k2k \geq 2 is said to be pairwise coprime if gcd(ai,aj)=1\gcd(a_i, a_j) = 1 for every pair of distinct indices iji \neq j. This condition ensures that no prime divides more than one element in the set. For example, the set {6,35,11}\{6, 35, 11\} is pairwise coprime, as gcd(6,35)=1\gcd(6, 35) = 1, gcd(6,11)=1\gcd(6, 11) = 1, and gcd(35,11)=1\gcd(35, 11) = 1. A set of integers is mutually coprime (also called setwise coprime) if the of all its elements is 1, that is, gcd(a1,a2,,ak)=1\gcd(a_1, a_2, \dots, a_k) = 1. This property is weaker than pairwise coprimality, as it only requires that no single prime divides every element in the set, without restricting shared factors between subsets. For instance, the set {6,10,15}\{6, 10, 15\} is mutually coprime since gcd(6,10,15)=1\gcd(6, 10, 15) = 1, but it is not pairwise coprime because gcd(6,10)=2>1\gcd(6, 10) = 2 > 1, gcd(6,15)=3>1\gcd(6, 15) = 3 > 1, and gcd(10,15)=5>1\gcd(10, 15) = 5 > 1. Pairwise coprimality implies mutual coprimality: if every pair has gcd 1, then no prime can divide all elements, so the overall gcd is 1. The converse does not hold, and the distinction first arises for sets of size 3, as any two integers are either both pairwise and mutually coprime or neither. A key property is that if the elements of a pairwise coprime set are each square-free (divisible by no squared prime greater than 1), then their product is also square-free. This follows from the unique prime factorization theorem, as no prime divides more than one factor, preventing any squared primes in the product.

Coprime Sets and Sequences

A coprime sequence refers to an infinite sequence of integers where each pair of consecutive terms is coprime, satisfying gcd(ai,ai+1)=1\gcd(a_i, a_{i+1}) = 1 for all ii. The , defined by F1=1F_1 = 1, F2=1F_2 = 1, and Fk=Fk1+Fk2F_k = F_{k-1} + F_{k-2} for k3k \geq 3, exemplifies this property, as consecutive terms are always coprime; more generally, gcd(Fm,Fn)=Fgcd(m,n)\gcd(F_m, F_n) = F_{\gcd(m,n)} for any positive integers mm and nn, ensuring the condition holds since Fd=1F_d = 1 when d=1d = 1. Infinite coprime sets consist of infinitely many integers that are pairwise coprime, meaning gcd(ai,aj)=1\gcd(a_i, a_j) = 1 for all distinct i,ji, j. The set of all prime numbers serves as a fundamental example, with distinct primes sharing no common prime factors. Additional constructions include the Fermat numbers Fn=22n+1F_n = 2^{2^n} + 1 for n0n \geq 0, which are pairwise coprime due to the relation FmF_m dividing Fn2F_n - 2 for m<nm < n, and Sylvester's sequence, defined by s0=2s_0 = 2 and sk=sk12sk1+1s_k = s_{k-1}^2 - s_{k-1} + 1 for k1k \geq 1, where each term is the product of all previous terms plus one, ensuring pairwise coprimality. Such sets highlight the existence of infinite pairwise coprime collections with varying growth rates and densities, from zero asymptotic density in the primes to sparser distributions in sequences like Sylvester's. A key property connecting coprime integers to sequences is Zsigmondy's theorem, which asserts that if aa and bb are coprime positive with a>b1a > b \geq 1 and n>1n > 1 is an , then anbna^n - b^n possesses a primitive prime divisor—a prime pp dividing anbna^n - b^n but no adbda^d - b^d for 1d<n1 \leq d < n—with exceptions only for (a,b,n)=(2,1,6)(a, b, n) = (2, 1, 6) and cases where n=2n = 2 and a+ba + b is a power of 2. This result guarantees new prime factors in sequences like anbna^n - b^n for coprime bases, aiding analysis of primitivity in cyclotomic polynomials and related constructions.

Probabilistic Aspects

Probability of Coprimality

The probability that two randomly selected positive integers aa and bb are coprime, meaning gcd(a,b)=1\gcd(a, b) = 1, is a fundamental result in analytic number theory. This probability equals 6π20.607927\frac{6}{\pi^2} \approx 0.607927, indicating that approximately 60.8% of pairs of positive integers share no common prime factors other than 1. The derivation relies on the Euler product formula for the Riemann zeta function ζ(s)\zeta(s). Specifically, the probability P(gcd(a,b)=1)P(\gcd(a, b) = 1) is given by the infinite product over all primes pp: P(gcd(a,b)=1)=p(11p2),P(\gcd(a, b) = 1) = \prod_p \left(1 - \frac{1}{p^2}\right), where the product converges because the sum p1p2\sum_p \frac{1}{p^2} is finite. This product equals 1ζ(2)\frac{1}{\zeta(2)}, and since ζ(2)=π26\zeta(2) = \frac{\pi^2}{6}, the probability simplifies to 6π2\frac{6}{\pi^2}. The interpretation arises from the fact that for each prime pp, the probability that pp does not divide both aa and bb is 11p21 - \frac{1}{p^2}, and independence over primes yields the full product. This result traces back to Leonhard Euler's 1737 paper "Variae observationes circa series infinitas," where he established the Euler product for ζ(s)\zeta(s) and evaluated ζ(2)=π26\zeta(2) = \frac{\pi^2}{6} using the infinite product over primes, laying the groundwork for the coprimality probability. The explicit connection to the probability of coprimality follows directly from this product, with convergence ensured by the finiteness of ζ(2)\zeta(2). In practice, for finite ranges, the proportion of coprime pairs (a,b)(a, b) with 1a,bN1 \leq a, b \leq N approaches 6π2\frac{6}{\pi^2} as NN \to \infty. The number of such pairs is asymptotically 6N2π2+O(NlogN)\frac{6N^2}{\pi^2} + O(N \log N), confirming the limiting probability through rigorous error bounds.

Density and Distribution

The natural density of the set of positive integers coprime to a fixed positive integer n>1n > 1 is ϕ(n)n\frac{\phi(n)}{n}, where ϕ\phi is . This implies that the number of such integers not exceeding xx is asymptotically ϕ(n)nx\frac{\phi(n)}{n} x, with an error term bounded by the number of divisors of nn. In higher dimensions, the asymptotic density of kk- of positive integers (m1,,mk)(m_1, \dots, m_k) with each mixm_i \leq x that are pairwise coprime is given by the over all primes pp of the local factor (11/p)k1(1+(k1)/p)(1 - 1/p)^{k-1} (1 + (k-1)/p), which simplifies for k=2k=2 to 6/π26/\pi^2 and yields smaller values for larger kk, such as approximately 0.286 for k=3k=3. This product arises from the probability that no prime divides more than one member of the tuple at each prime locus, and while it lacks a closed form like the mutual coprimality case, numerical evaluation shows it decreases with kk. For mutual coprimality (gcd of all kk being 1), the density is instead 1/ζ(k)1/\zeta(k), where ζ\zeta is the , providing a benchmark for comparison in multidimensional settings. The integers coprime to a fixed nn exhibit equidistribution properties in arithmetic progressions. Specifically, when gcd(m,n)=1\gcd(m, n) = 1, these integers are equidistributed mm, meaning each residue class a(modm)a \pmod{m} contains asymptotically the same proportion ϕ(n)nm\frac{\phi(n)}{n m} of them up to xx. More generally, for progressions a(modm)a \pmod{m} with gcd(a,m)=1\gcd(a, m) = 1, the coprime integers align uniformly under compatibility conditions with nn, reflecting the periodic nature of the set via the . Despite these average behaviors, the distribution of coprime pairs and tuples displays irregularities and gaps, particularly in short intervals or along specific lines in the lattice. The Hardy-Littlewood conjectures, through the circle method and singular series, predict fine-scale asymptotics for the count of coprime pairs (m,n)(m, n) with bounded differences or in restricted regions, accounting for local obstructions at primes and suggesting Poisson-like fluctuations around the mean density. These conjectures remain unproved but guide estimates for gaps between consecutive coprime integers or tuples.

Generating Coprime Pairs

Algorithms and Methods

One effective method for generating coprime integer pairs involves the use of s, which systematically enumerate all reduced fractions ab\frac{a}{b} where 0abN0 \leq a \leq b \leq N, gcd(a,b)=1\gcd(a, b) = 1, and the fractions are ordered increasingly between 0 and 1. The construction is recursive: begin with the Farey sequence of order 1, F1=(01,11)F_1 = \left( \frac{0}{1}, \frac{1}{1} \right). To obtain FnF_n from Fn1F_{n-1}, insert the a+cb+d\frac{a + c}{b + d} between every pair of adjacent fractions ab\frac{a}{b} and cd\frac{c}{d} in Fn1F_{n-1} whenever b+d=nb + d = n, ensuring all inserted fractions are in lowest terms. This process generates approximately 3N2π2\frac{3N^2}{\pi^2} coprime pairs up to denominator NN, providing a complete list without duplicates or omissions for the specified range. Sieve-based approaches adapt the to identify and mark non-coprime pairs within bounds up to NN, enabling efficient enumeration of coprime ones. Precompute the smallest prime factor for each up to NN using a linear in O(NloglogN)O(N \log \log N) time. Then, for generating pairs (a,b)(a, b) with 1a,bN1 \leq a, b \leq N, iterate over possible values and use the precomputed factors to skip or mark positions sharing common primes, effectively filtering to retain only coprime pairs. This method avoids computing the GCD for every potential pair, reducing redundant operations by leveraging prime multiplicity markings across the range. For random generation of coprime pairs, rejection sampling offers a straightforward probabilistic : select integers aa and bb uniformly at random from [1,N][1, N], compute gcd(a,b)\gcd(a, b), and accept the pair if it equals 1; otherwise, reject and resample. The acceptance probability is 6π20.6079\frac{6}{\pi^2} \approx 0.6079, implying an expected π261.64493\frac{\pi^2}{6} \approx 1.64493 trials per valid pair, independent of NN for large ranges. This efficiency stems from the asymptotic density of coprime pairs among all integer pairs, derived from the Euler product over primes. This efficiency stems from the asymptotic density of coprime pairs among all integer pairs, derived from the Euler product over primes. The overall for generating all coprime pairs up to NN using sieve-based methods is O(N2)O(N^2), accounting for the summation over primes in the marking process and the output size of approximately 6N2π2\frac{6N^2}{\pi^2} pairs.

Constructions and Examples

One of the simplest constructions of coprime pairs is the set of consecutive integers (n,n+1)(n, n+1) for any n1n \geq 1. These pairs are always coprime, as any common d>1d > 1 of nn and n+1n+1 would also divide their difference (n+1)n=1(n+1) - n = 1, which is impossible. Pairs of distinct primes (p,q)(p, q) with pqp \neq q form another infinite family of coprime integers. By the definition of primes, the only positive divisors of pp are 1 and pp, and similarly for qq; since pqp \neq q, the only shared is 1, so gcd(p,q)=1\gcd(p, q) = 1. A further construction yields coprime pairs from powers of 2 and odd integers: for k1k \geq 1 and any odd positive integer mm, the pair (2k,m)(2^k, m) satisfies gcd(2k,m)=1\gcd(2^k, m) = 1. This holds because the prime factorization of 2k2^k consists solely of the prime 2, while mm has no factor of 2, as guaranteed by the , which uniquely decomposes every positive integer into a power of 2 times an odd part. Consecutive Fibonacci numbers provide yet another infinite family of coprime pairs: for the sequence defined by F1=1F_1 = 1, F2=1F_2 = 1, and Fn=Fn1+Fn2F_n = F_{n-1} + F_{n-2} for n3n \geq 3, it follows that gcd(Fn,Fn+1)=1\gcd(F_n, F_{n+1}) = 1 for all n1n \geq 1. This is proven by induction: the base cases gcd(F1,F2)=gcd(1,1)=1\gcd(F_1, F_2) = \gcd(1, 1) = 1 hold, and assuming gcd(Fk,Fk+1)=1\gcd(F_k, F_{k+1}) = 1, any common divisor of Fk+1F_{k+1} and Fk+2=Fk+1+FkF_{k+2} = F_{k+1} + F_k would divide FkF_k, contradicting the inductive hypothesis unless the divisor is 1. Illustrative examples of coprime pairs can be found among small positive integers. The table below lists the first 10 such pairs (a,b)(a, b) with 1a<b201 \leq a < b \leq 20, ordered lexicographically by increasing aa and then bb:
aabb
12
13
14
15
16
17
18
19
110
111
These examples highlight how coprimality arises frequently, particularly with 1 paired to any integer, since gcd(1,b)=1\gcd(1, b) = 1 for all bb. Coprime pairs also manifest geometrically as lattice points in the plane. The points (m,n)(m, n) with m,nZm, n \in \mathbb{Z} and gcd(m,n)=1\gcd(m, n) = 1 are visible from the origin, meaning the line segment from (0,0)(0,0) to (m,n)(m, n) contains no other lattice points. This visualization underscores the sparsity of such points, with their density related to the probability 6/π20.6076/\pi^2 \approx 0.607 that two random integers are coprime. A special case drawing an analogy to integer coprimality appears in polynomials over the integers: the polynomials xx and x+1x+1 are coprime, as gcd(x,x+1)=gcd(x,(x+1)x)=gcd(x,1)=1\gcd(x, x+1) = \gcd(x, (x+1) - x) = \gcd(x, 1) = 1 via the Euclidean algorithm. Evaluating these at any integer tt yields the coprime pair (t,t+1)(t, t+1), linking polynomial and integer constructions.

Applications

In Number Theory

Coprime integers play a fundamental role in number theory, particularly through functions and theorems that quantify their distribution and properties. One key example is , denoted ϕ(n)\phi(n), which counts the number of positive integers up to nn that are coprime to nn. This function is defined for any positive integer nn and satisfies the formula ϕ(n)=npn(11p)\phi(n) = n \prod_{p \mid n} \left(1 - \frac{1}{p}\right), where the product runs over the distinct prime factors pp of nn. Additionally, via Möbius inversion, ϕ(n)\phi(n) can be expressed as ϕ(n)=dnμ(d)nd\phi(n) = \sum_{d \mid n} \mu(d) \frac{n}{d}, where μ\mu is the . Dirichlet's theorem on arithmetic progressions asserts that if aa and mm are coprime positive integers, then there are infinitely many primes congruent to aa modulo mm. This result, established by Dirichlet in 1837, relies crucially on the coprimality condition to ensure the arithmetic progression contains primes, as non-coprime cases yield at most one prime. The theorem extends the understanding of prime distribution beyond the classical prime number theorem by incorporating modular constraints. Variants of the prime number theorem incorporate coprimality in their error terms for the counting function π(x;q,a)\pi(x; q, a), which denotes the number of primes up to xx congruent to aa modulo qq. Specifically, when gcd(a,q)=1\gcd(a, q) = 1, the asymptotic π(x;q,a)1ϕ(q)xlogx\pi(x; q, a) \sim \frac{1}{\phi(q)} \frac{x}{\log x} holds, with error terms analyzed through Dirichlet L-functions associated to coprime residue classes. This equidistribution among coprime classes modulo qq underscores the balanced spread of primes in such progressions. Möbius inversion further highlights coprimality through the identity dgcd(k,n)μ(d)=1\sum_{d \mid \gcd(k, n)} \mu(d) = 1 if gcd(k,n)=1\gcd(k, n) = 1 and 00 otherwise, serving as an indicator function for coprime pairs. This property arises from the fact that dgμ(d)=[g=1]\sum_{d \mid g} \mu(d) = [g = 1] for any positive integer gg, where [][ \cdot ] is the Iverson bracket. In broader applications, such as inverting sums over divisors, this enables the extraction of contributions solely from coprime terms in arithmetic functions.

In Cryptography and Computing

The RSA cryptosystem, introduced in 1978, relies on the coprimality of the public encryption exponent ee and Euler's totient function ϕ(n)\phi(n), where n=pqn = pq for distinct primes pp and qq, ensuring that ee has a modular multiplicative inverse modulo ϕ(n)\phi(n) for decryption. Decryption works by computing the private exponent dd such that ed1(modϕ(n))ed \equiv 1 \pmod{\phi(n)}, which exists precisely because gcd(e,ϕ(n))=1\gcd(e, \phi(n)) = 1, allowing recovery of the plaintext via m=cdmodnm = c^d \mod n for ciphertext cc. In RSA key generation, the moduli pp and qq are chosen as distinct primes, guaranteeing gcd(p,q)=1\gcd(p, q) = 1, which enables efficient computation of ϕ(n)=(p1)(q1)\phi(n) = (p-1)(q-1) and supports the security based on the difficulty of factoring nn. The extended Euclidean algorithm is used to find dd, leveraging the coprimality to compute the inverse in O(logn)O(\log n) time, making it practical for large keys. In computing, coprime parameters enhance uniformity in pseudorandom number generators, such as linear congruential generators (LCGs) of the form Xn+1=(aXn+c)modmX_{n+1} = (a X_n + c) \mod m, where full-period conditions from the Hull-Dobell theorem require gcd(c,m)=1\gcd(c, m) = 1 and gcd(a,m)=1\gcd(a, m) = 1 (among others) to ensure the sequence cycles through all residues modulo mm. This coprimality prevents short cycles and promotes statistical uniformity, as seen in widely used LCG implementations for simulations and hashing. In post-quantum cryptography during the 2020s, lattice-based schemes like use coprime polynomials to ensure invertibility in polynomial rings, such as requiring the private polynomial ff to be coprime with the ring modulus xN1x^N - 1 modulo small primes pp and qq for computing inverses during key generation and decryption. This property, verified via the extended Euclidean algorithm adapted for polynomials, supports 's resistance to quantum attacks while maintaining efficiency, with variants like NTRU Prime, which was evaluated as an alternate candidate in NIST's PQC standardization process but not selected for standardization.

Generalizations

To Multiple Integers

The generalization of coprimality to multiple integers, specifically k-tuples where k > 2, distinguishes between mutual coprimality—where the of all k integers is 1—and pairwise coprimality, where every pair among the k integers has 1. These notions differ for k > 2, as mutual coprimality permits some pairs to share common factors greater than 1, provided no single prime divides all elements. For instance, the triple (6, 15, 35) satisfies gcd(6, 15, 35) = 1 but fails pairwise coprimality since gcd(6, 15) = 3 > 1. In contrast, the triple (8, 9, 25) achieves pairwise coprimality, with gcd(8, 9) = 1, gcd(8, 25) = 1, and gcd(9, 25) = 1, and thus also mutual coprimality. Trivial examples include (1, 1, 1), where all gcds are 1. There exist infinitely many k-tuples of pairwise coprime positive integers for any fixed k ≥ 2; a simple takes the k-th powers of the first k distinct primes, such as (2^k, 3^k, ..., p_k^k), ensuring no two share a common prime factor. The Hardy-Littlewood k-tuple conjecture, which posits that admissible k-tuples of linear forms produce infinitely many simultaneous primes under certain conditions, implies the existence of infinitely many k-tuples of distinct primes that are pairwise coprime, as distinct primes share no common factors greater than 1. The natural density, or asymptotic probability, that k randomly selected positive integers up to n are mutually coprime approaches 1/ as n → ∞, where ζ denotes the Riemann zeta function; this follows from the Euler product over primes, reflecting the independence of divisibility by distinct primes. For pairwise coprimality, the probability is more intricate, involving higher-order zeta values, but remains positive and bounded away from zero.

In Algebraic Structures

In polynomial rings, the notion of coprimality extends the integer case to elements with coefficients in Z\mathbb{Z}. Two polynomials f,gZf, g \in \mathbb{Z} are said to be coprime if their greatest common divisor is a constant polynomial, meaning no non-constant polynomial divides both. This definition aligns with the Euclidean algorithm applied to polynomials, where the gcd is computed via repeated division, analogous to integers. A key result facilitating computations and irreducibility criteria is Gauss's lemma, which states that the product of two primitive polynomials (those with content 1, i.e., gcd of coefficients is 1) is primitive. This lemma implies that if a polynomial in Z\mathbb{Z} factors non-trivially in Q\mathbb{Q}, then it factors similarly in Z\mathbb{Z} after scaling, preserving coprimality properties across rings. For example, consider the polynomials x2+1x^2 + 1 and x1x - 1 over Q\mathbb{Q}. Applying the Euclidean algorithm, divide x2+1x^2 + 1 by x1x - 1: the remainder is (1)2+1=2(1)^2 + 1 = 2, a constant, so their gcd is 1, confirming they are coprime. Over Z\mathbb{Z}, both are primitive, and their coprimality holds since no prime divides all coefficients of a common non-constant divisor. This example illustrates how coprimality in polynomial rings detects the absence of shared irreducible factors, bridging to applications in factorization. In the ring of Gaussian integers Z={a+bia,bZ}\mathbb{Z} = \{a + bi \mid a, b \in \mathbb{Z}\}, coprimality is defined using the norm N(α)=αα=a2+b2N(\alpha) = \alpha \overline{\alpha} = a^2 + b^2 for α=a+bi\alpha = a + bi, which is multiplicative: N(αβ)=N(α)N(β)N(\alpha \beta) = N(\alpha) N(\beta). Two Gaussian integers α,β\alpha, \beta are coprime if their gcd is a unit (1, -1, i, or -i), equivalently if N(gcd(α,β))=1N(\gcd(\alpha, \beta)) = 1. The gcd can be computed via the , leveraging that Z\mathbb{Z} is a with respect to the norm. For instance, 3 and 1+2i1 + 2i are coprime because N(3)=9N(3) = 9 and N(1+2i)=5N(1 + 2i) = 5 share no common prime factors in Z\mathbb{Z}, and direct computation yields gcd 1 up to units. In more general algebraic structures, such as the ring of integers OK\mathcal{O}_K of a number field KK, coprimality is often defined for ideals rather than elements, though it extends to principal ideals generated by elements. Two ideals a,bOK\mathfrak{a}, \mathfrak{b} \subseteq \mathcal{O}_K are coprime if a+b=OK\mathfrak{a} + \mathfrak{b} = \mathcal{O}_K, meaning their sum is the unit ideal, or equivalently, ab=ab\mathfrak{a} \mathfrak{b} = \mathfrak{a} \cap \mathfrak{b}. This property holds in Dedekind domains like OK\mathcal{O}_K, where every nonzero ideal factors uniquely into primes. In quadratic fields K=Q(d)K = \mathbb{Q}(\sqrt{d})
Add your contribution
Related Hubs
User Avatar
No comments yet.