Array rotation 2026-10-31
A right array rotation by sends the entry originally at offset to offset for nonempty length . Equivalently it changes adjacent blocks into when . Identity rotations include and .
Three reversals implement the operation: . Alternatively repeatedly use a block swap to put the smaller block in its final position and recurse on the remaining unresolved segment. Replacing that tail recursion by parameter updates gives constant auxiliary storage. If counts swaps for blocks of lengths , then and for unequal lengths. The Euclidean algorithm shows by induction that , so a right rotation uses element swaps for .
Computing Legendre symbols by quadratic reciprocity Created 2026-10-14 Updated 2026-10-31
The practical reward of quadratic reciprocity is a smaller modulus: swap a pair of distinct odd primes, record the required sign, then reduce the numerator by modular arithmetic. Use multiplicativity of the Legendre symbol and the second supplementary law for quadratic reciprocity to handle a factor of two. For example,
Here are both modulo , so the first swap changes sign; gives ; the swap involving five has no sign change. An independent square check is . The method determines existence of a square root without itself finding that root.
A composite numerator is allowed in a Legendre symbol; a composite denominator instead calls for a Jacobi symbol. Its Jacobi reciprocity law supports repeated swaps and remainder reductions, in the spirit of the Euclidean algorithm.[ref]
A final Jacobi symbol of one is not a square-existence certificate for a composite number modulus. For example,
yet is impossible: reducing it modulo three would require a square congruent to two, and squares modulo three are only zero or one. The product has hidden two local failures. By contrast, for a prime denominator, a Legendre symbol of one does certify a quadratic residue.
Divisibility Created 2026-09-24 Updated 2026-10-18
For integers , divides when multiplication by some integer takes to :
Then is a divisor of , and is an integer multiple of . The notation means that no such integer exists. For , this is equivalent to saying that the quotient is an integer, or that Euclidean division by leaves remainder zero.
For example, because , whereas because . Signs do not change divisibility: because , and because . In general, changing the sign of either input preserves the relation.
The definition here permits zero as either input. Every integer divides zero, since . In particular, ; however, whenever , since is always zero. This is a statement about multiplication, and assigns no meaning to division by zero: remains undefined.
Two useful properties come directly from the defining multiplication. Divisibility is a reflexive relation, since , and a transitive relation: if and , then . Moreover, a shared divisor divides every integer linear combination:
Indeed, writing and gives . For example, and imply . This small observation explains why the Euclidean algorithm preserves common divisors, and why Bézout's identity can certify a greatest common divisor.
On the positive integers, divisibility is a partial order: if and , then . The restriction matters, since and although . The prime factorization viewpoint makes this order concrete: exactly when every prime valuation of is at most the corresponding prime valuation of . Thus one relation connects equal grouping, prime factorization, and modular arithmetic.
Book VII, definitions 3 and 5 of Euclid's Elements describe the corresponding positive-number relation through one number measuring another and through integer multiples. The sign and zero conventions above belong to the present integer formulation, rather than to those ancient definitions. [ref]
Euclid game 2026-10-20
A game on two positive integers in which a move subtracts a positive multiple of the smaller from the larger without making it negative. The position is then reordered. This is an impartial game related to the Euclidean algorithm; the exact terminal and winning convention must be stated.
Extended Euclidean algorithm Created 2026-09-29 Updated 2026-10-20
The extended Euclidean algorithm also computes integers satisfying , as in Bézout's identity. Back-substitution in the calculation under the Euclidean algorithm gives
Thus solves . The linear Diophantine equation is solvable exactly when divides : necessity follows from common divisibility, and multiplying this identity proves sufficiency. For coprime integers , the coefficient of is a modular inverse of modulo , and the coefficient of is a modular inverse of modulo , when the respective modulus is greater than one.
Fibonacci gcd reduction 2026-10-14
Consecutive Fibonacci numbers are coprime by the Euclidean algorithm. The Fibonacci addition formula writes for . Taking the greatest common divisor with removes the last summand, and multiplication by the coprime factor leaves that gcd unchanged. The case uses . Applying the Euclidean algorithm to the indices yields the strong-divisibility identity for nonnegative indices, with the usual zero conventions.
Floor sum 2026-10-20
A floor sum adds values of a floor function, often in the form for integers , , , and . If , it counts lattice points with and . Splitting and into quotients and remainders isolates an arithmetic progression and a constant contribution; swapping the remaining counting axes leads to an Euclidean algorithm reduction.
Greatest common divisor Created 2026-09-24 Updated 2026-10-20
For integers not both zero, their greatest common divisor is the largest positive integer dividing both. It is unchanged by replacing either input by its negative. The convention is useful, but this exceptional value is not a largest positive common divisor. For positive inputs, the Euclidean algorithm computes the answer, and Bézout's identity expresses it as an integer linear combination of the inputs.
For and , a common divisor can contain at most one copy of the prime number two and one of the prime number three. Taking the smaller prime valuation at each prime number therefore gives
The check is also a Bézout's identity: every common divisor divides this difference, and six itself divides both inputs. More generally, every common divisor divides the greatest common divisor, a stronger statement than merely being no larger than it. The companion least common multiple takes the larger prime valuations, as the diagram there illustrates. For an application, divide the numerator and denominator of the fraction by six to obtain ; these remaining integers are coprime.
Integer factorization Created 2026-10-13 Updated 2026-10-20
Integer factorization seeks the prime factorization of a positive integer . For , this means identifying its prime factors and their multiplicities; one has the empty prime factorization. Finding one proper divisor is useful progress, but need not finish the job: factor and further until all factors are prime numbers.
For example, is a semiprime, whereas has three prime factors. Primality testing asks whether a proposed integer is prime; it need not return a factor when the answer is no. Trial division is a direct factoring method: try division by small prime numbers until a divisor is found. More elaborate methods obtain a proper divisor through a greatest common divisor of with a specially constructed integer.
The beautiful trick in congruence of squares is that two integers with equal squares modulo can reveal different factors through their sum and difference. In the worked example, gives and . Computing those greatest common divisors uses the Euclidean algorithm; it does not require trying every potential factor. A factor base supplies a systematic way to construct useful equal-square relations. [ref].
This connection is useful in cryptography because recovering the factors of an RSA cryptosystem modulus defeats the factoring assumption behind its construction. That application concerns large, carefully chosen inputs; the small examples here explain the arithmetic mechanism and are not benchmarks or estimates of present cryptographic security.
Least common multiple Created 2026-09-24 Updated 2026-10-20
For positive integers , their least common multiple is the smallest positive integer that is an integer multiple of both. Write it as . A positive common integer multiple always exists, since is one, but it can be larger than necessary.
For example, the positive integer multiples of begin , while those of begin . Their first positive coincidence is , so . Both also divide zero, but the word positive excludes zero from this minimum.
Suppose two events happen every twelve and eighteen days, and both happen at day . Their next meeting is at day , after three twelve-day intervals and two eighteen-day intervals. Through day , their common event times are .
Figure 1.
Events every 12 and 18 days, starting together, meet again every 36 days
. Each row marks the nonnegative integer multiples of its interval from zero through 72. The highlighted columns are shared; 36 is the first positive one and hence the least common multiple. Details.
The prime factorization explains why this coincidence occurs. For the integers and ,
A common integer multiple must contain at least the prime valuations required by each input. Taking the larger prime valuation at each prime number meets both requirements with no extra factors. The greatest common divisor uses the smaller prime valuations instead. This is the same coordinate comparison developed under prime factorization, applied in opposite directions.
Figure 2.
For 12 and 18, smaller prime valuations give greatest common divisor 6 and larger ones give least common multiple 36
. Bars show the exponents of the prime numbers two and three in , , and . The table makes the minimum and maximum in each column explicit. Details.
For any positive integers , the prime valuations give
The proof outline is one observation at each prime number: . Hence the two sides have identical prime factorizations. Numerically, . This also gives a calculation using the Euclidean algorithm for the greatest common divisor, without first finding the prime factors of both inputs.
Every positive common integer multiple is an integer multiple of the least common multiple, because its prime valuations must be at least the larger input prime valuations. Including negatives and zero, the common integer multiples of and are exactly for integers . For more than two positive integers, the same definition and rule of taking the largest prime valuations apply; one may also combine inputs successively. For example, .
For nonzero signed integers, take absolute values: . We extend the definition to zero by the convention , since zero is then the only common integer multiple; this is an extension, not a positive minimum. In particular must be handled separately from the displayed quotient, which would involve division by zero.
The least common multiple is useful for combining fractions with the smallest positive shared denominator. For example,
Its scheduling interpretation requires care about starting times. If the events start at integer days and , a common time must satisfy the integer congruences and . The Chinese remainder theorem for noncoprime moduli says a solution exists exactly when . If it exists, solutions form one congruence class modulo , but the first meeting need not be day . With starts , the first meeting is day and subsequent meetings are ; with , they never meet. The beauty of the least common multiple is the exact shared spacing, while the integer congruences determine whether and where the spacing begins.
Book VII, Proposition 34 of Euclid's Elements constructs the least common multiple of two numbers, and Proposition 36 extends the construction to three by first combining two of them. In modern notation this is . These are specific ancient treatments of the construction, rather than a claim about its first discovery. [ref] [ref]
Linear congruence Created 2026-09-29 Updated 2026-10-14
A linear congruence asks for the integers satisfying , where are integers and . Let be their greatest common divisor. There are solutions exactly when divides . When solutions exist, there are exactly solution classes modulo , obtained from one solution by
The divisibility condition follows immediately from : every common divisor of must divide . Conversely, Bézout's identity constructs a solution when . Differences between any two solutions obey , equivalently , since and are coprime. This explains both the spacing and the number of solution classes.
For a complete example, solve . Here divides nine. Dividing the corresponding divisibility statement by three changes the integer modulus too:
Because , multiplying by the modular inverse three gives . Lifting this class back to modulus fifteen yields . Direct substitution gives , and , each with remainder nine after division with remainder by fifteen. By contrast, has no solutions, because three does not divide ten.
Figure 1.
Multiplication by six modulo fifteen hits residue nine three times and never hits residue ten
. Details.
This is why ordinary-looking division cannot be performed blindly in modular arithmetic. Reducing the equation and its integer modulus together keeps all solutions; retaining modulus fifteen after dividing by three would lose valid classes. When , the modular inverse of exists and gives a unique class . The Euclidean algorithm computes the Bézout coefficients needed for this construction. [ref]
Lucas number 2026-10-14
The Lucas numbers obey the same second-order recurrence as the Fibonacci numbers but start with , so their sequence is . For , . Substitution in the Fibonacci addition formula gives . Consecutive Fibonacci numbers are coprime by the Euclidean algorithm; since , Bézout's identity gives .
Number theory Created 2026-09-24 Updated 2026-10-13
Number theory studies integers, their divisibility, and the patterns created by prime numbers. Its questions often have short statements but rigid answers: which integers divide a given one, when does an equation have integer solutions, and when can arithmetic with congruence classes be reversed? The Euclidean algorithm and modular multiplicative inverses connect these questions through explicit calculations.
For example, and . Their shared prime factors give greatest common divisor . The Euclidean algorithm reaches that answer without finding either complete prime factorization. It also produces , an instance of Bézout's identity. This relation certifies every common divisor at once and solves an associated linear Diophantine equation.
Modular arithmetic retains only remainders, but the lost information can be surprisingly controlled. Multiplication by modulo is a permutation of all residue classes, because has modular inverse . Multiplication by modulo collapses fifteen residue classes to three. Thus an apparently small change in the modulus changes whether a calculation can be reversed. The Chinese remainder theorem explains another kind of compression: remainders modulo coprime integers can be combined into one remainder modulo their product.
Simple restrictions help reveal the structure without telling the whole story. Every prime number greater than three is congruent to or modulo : the other four residue classes force divisibility by or . The converse fails because and lie in those classes but are composite numbers. Necessary conditions are useful filters, not substitutes for primality testing.
The subject's appeal lies partly in this tension: prime factorization gives a clean description of every positive integer, while identifying factors and predicting their distribution lead to substantial further questions. Analytic number theory uses tools from analysis to study global patterns, and algebraic number theory extends arithmetic into number fields. Applications include cryptography and error-correcting codes; MIT's discrete applied mathematics course develops modular structures for both purposes. [ref]
Euclid's Elements already gives a greatest-common-measure construction in Book VII, Proposition 2, and the argument that a finite list cannot exhaust the prime numbers in Book IX, Proposition 20. These are documented ancient treatments, rather than evidence that all of number theory began with one author. [ref] [ref]
The nondegenerate power-equation problem uses fixed positive , fixed , positive integer bases, and exponents . Lower exponents are separate: is linear, while can be a generalized Pell equation with infinitely many solutions. For example has the infinite sequence generated by . The pair also persists for every exponent when , so it must be separated if exponents are to be bounded. For , the Euclidean algorithm gives a particular solution when , and all solutions follow by adding multiples of . For , put to obtain with the congruence . If is a square, factor the left side; otherwise the standard Pell reduction gives finitely many fixed-norm representatives and their fundamental-unit orbits, with the congruence selecting the allowed terms. This is an effective description even when the set is infinite.
For and sufficiently large , the equation makes and comparable, both bounded below by a fixed multiple of . Their ratio gives
If , a two-logarithm estimate has one fixed algebraic argument and one variable rational argument , of arithmetic height at most . It gives . A zero fixed logarithm is omitted, leaving the valid one-logarithm case. Therefore , effectively bounding . If , directly use ; this is either impossible or bounds both base and exponent. Cases where stays small are finite and directly enumerable.
For signed integer bases, split according to the parity of and the signs. Cases reducing to a sum of positive powers are elementary because their sum is fixed; zero or absolute-value-one bases give separately detectable constant-power families.
For each bounded , the form has distinct projective roots. The three-factor unit-equation argument of Question 5 gives an effective finite list of pairs, even if the binomial is reducible. Consequently all nondegenerate solutions can be effectively found, with the linear/Pell families and constant-base exception treated separately. This is the exponent bound for a binomial power equation.
For the polynomial generalization the precise Schinzel-Tijdeman exponent theorem is needed: if fixed has at least two distinct complex roots, solutions with integers , , and have effectively. The hypotheses cannot be dropped. The one-root polynomial gives , for every , and the two-root polynomial gives , for every .
To indicate the extension, factor over its splitting field with root multiplicities . Distinct factors have common ideal divisors only over a fixed finite collection of primes. At other primes the identity forces each root factor's valuation to be a multiple of . Ideal classes and fundamental units supply the remaining finitely specified factors. Generalized logarithmic-form estimates for these power equations control the unit terms and exceptional primes and bound those reduced exponents; since , they bound . This is why distinct roots and nontrivial perfect powers are indispensable to the asserted finiteness of exponents.
The Euclidean algorithm gives
Back substitution produces the Bézout's identity
Hence a positive integer solution is . More generally, subtracting this identity from any other solution shows . Since and are coprime, the integer solutions are , ; both are positive precisely when .
The Euclidean algorithm and the Fibonacci number recurrence give
Iterating reaches , so consecutive Fibonacci numbers are coprime.
Prove the Fibonacci addition formula by mathematical induction on , asserting it simultaneously for every . At , . Suppose the formula holds at . Apply it with in place of and use the recurrence:
Thus
For , prove by induction on . The case is immediate. For , put in the addition formula. Its first term is divisible by by the induction hypothesis, and its second term has an explicit factor . Therefore
When , put . Reducing the addition formula modulo gives . Since is coprime to , multiplication by it leaves the greatest common divisor with unchanged: any divisor of dividing the product divides , by the Bezout identity or the Euclid lemma. This proves the Fibonacci gcd reduction
At both sides equal , since . The case is also immediate from ; the divisibility statement at reads , valid under the usual definition iff for an integer .
A linear length- cyclic code is a subspace closed under cyclic coordinate shifts. Identify a word with its polynomial modulo ; multiplying by performs the shift. Thus a cyclic code is an ideal of . Its preimage in the polynomial ring is an ideal containing , so the Euclidean algorithm gives a unique monic generator dividing . The generator polynomial of a cyclic code is and the check polynomial of a cyclic code is ; a word lies in the code exactly when .
For the binary length-seven code, the given factors with
This cubic has no binary root and is irreducible. Let be its root in . Since the nonzero multiplicative group has prime order seven and , its seven powers enumerate all nonzero elements. The condition gives a three-row binary parity-check matrix whose columns are precisely the seven nonzero vectors of . This is Hamming's code in a cyclic coordinate order. It has dimension four, and minimum distance three: no one or two distinct nonzero columns sum to zero, while itself has weight three. Its sixteen radius-one balls have total size , confirming the original perfect Hamming code.
It actually contains its dual code in this coordinate order. Each parity-check row has four ones, and any two distinct rows have two simultaneous ones, so over . The row space therefore lies in . Equivalently the dual generator is the reciprocal check polynomial
which is divisible by . Hence there is a three-dimensional subcode equal to the dual, and in any other coordinate order it is equivalent to that dual.
The Euclidean algorithm gives
Back-substitution supplies the Bezout identity
Thus one solution is . If is any solution, subtraction gives . Since and are coprime, divides . Write ; substitution then gives . Conversely these values satisfy the equation for every integer . Hence all solutions are
Let be the consecutive primitive toric ray vectors around the compact invariant curve . Smoothness gives oriented determinants , hence for an integer . Choose an algebraic torus character with and . The principal divisor on a toric variety has coefficient one at , coefficient at , and zero at . The other invariant curves do not meet , while each adjacent one meets it transversely once. Intersecting this principal divisor with the proper curve gives . This proves the self-intersection formula for a toric surface divisor even when the ambient surface is not complete.
If , then and . The vectors form a lattice basis since , and their toric cone is the union of the two toric cones adjacent to . Deleting is consequently a smooth toric fan coarsening. Its inverse is precisely the toric blowup at a torus-fixed point, obtained by inserting the sum of the two primitive basis vectors. Conversely, that insertion gives , and hence algebraic self-intersection . Thus the toric contraction of a minus-one curve satisfies
For the cyclic quotient description, first take a strongly convex toric cone of dimension two. Write its primitive boundary vectors as and put , . Since is primitive, extend it to a basis of and write with . Thus is cyclic of order . In the lattice , the toric cone is smooth and its toric variety is . Passing to the larger lattice takes the finite quotient whose invariant monomials are precisely those in the smaller dual lattice . Relative to the two boundary coordinates, , so a generator acts with weights modulo . Replacing that generator by a suitable power makes the first weight one and the second some with and . Therefore, for the singular case,
The cyclic quotient surface singularity can equivalently be described by the first-quadrant toric cone in
Indeed its coordinate ring is . Characteristic zero ensures the stated ordinary finite-group quotient interpretation.
The restriction to singular toric cones of dimension two is necessary for . A smooth toric cone has and gives with the trivial quotient. A toric cone of dimension one gives , and the zero toric cone gives . These latter surfaces cannot be a quotient of the displayed kind, since they have nonconstant invertible regular functions, whereas has only constant units. Thus the blanket affine-surface wording requires these separate cases.
For the singular case, compute the negative continued fraction by the ceiling form of the Euclidean algorithm. Start with , , and, while , set
Then , so the process terminates at . The gcd is unchanged at each step, hence . Since , every . Rearranging the recurrence gives
Now define lattice vectors
To verify this Hirzebruch–Jung resolution algorithm, write with , and . Induction gives , so . It also gives . Thus every adjacent pair has absolute determinant , the covolume of , and is a basis of . The increase strictly, while the decrease to zero, so these toric rays occur in order inside the first quadrant. At termination, and the determinant identity gives , hence . All boundary and inserted vectors are primitive because they occur in lattice bases.
Subdivide the quadrant by . Every resulting toric cone is smooth by the smoothness criterion for a toric variety, and the fan subdivision gives a proper birational toric morphism, hence a resolution. Each interior toric ray has a complete one-dimensional star, so its exceptional curve of a surface resolution is . The recurrence yields
This proves minimality: no exceptional curve of a surface resolution can be contracted to a smooth point by the Castelnuovo contraction criterion. There is also a direct toric fan check. For fixed , the determinants of with , measured in units of the lattice covolume, satisfy the same recurrence with coefficients at least two and initial values zero and one. They are at least . Omitting any intervening toric ray therefore leaves a toric cone of determinant at least two, so no nontrivial coarsening is smooth. Thus this is the minimal resolution of a cyclic quotient surface singularity.
If all exceptional algebraic self-intersections are , all and induction gives . Since are coprime, this forces , . Conversely has exactly coefficients equal to two. Therefore
For the final toric fan, the minimal smooth fan subdivision of the toric cone from to inserts the toric rays for . Adjacent determinants have absolute value one, and , so its inserted curves have algebraic self-intersection and it is the minimal fan subdivision just described. The second original toric cone, from to , is already smooth.
Write and . In the resolved toric fan, the rightmost interior toric ray obeys , so its curve has algebraic self-intersection and can be blown down to a smooth point. After deleting it, the same relation applies to the new rightmost interior toric ray. Continue deleting in that order. Each deletion is the inverse of a toric blowup at a torus-fixed point. The last toric fan has only the quadrant toric cone and defines . Consequently
All maps induce the identity on the dense algebraic torus, so this composite is the same morphism as . The intermediate smooth toric fans need not include the singular toric fan .
Take as a subgroup of . It is discrete because representatives have integer entries, so a bounded set of matrices contains only finitely many such representatives, modulo the two choices of sign. It is finitely generated by
The Euclidean algorithm on the first column of an integer determinant-one matrix reduces it using these two transformations, proving the generation statement.
It is non-elementary. The powers of move an interior upper-half-space point towards , so . Conjugating by gives a parabolic with fixed point , and conjugating that parabolic by gives one with fixed point . Their interior orbits approach those respective points. Thus are three distinct points in the Kleinian limit set.
However in the projective group, and is a nonidentity elliptic Möbius transformation fixing the hyperbolic geodesic with boundary endpoints . It is a half-turn around that axis. Near an ordinary point of the axis, quotienting identifies the transverse angle modulo , giving cone angle instead of . The elliptic stabilizer obstruction to a hyperbolic manifold quotient therefore gives
The obstruction is the nonfree action, not finite generation or elementary behavior. An underlying topological quotient can still be a manifold; the conical quotient metric is what prevents this example from being a hyperbolic manifold quotient.