Greatest common divisor


The greatest common divisor (GCD) of two integers that are not both zero is the largest positive integer that divides both of them. It's their largest shared factor. Like the least common multiple, it can be efficiently found with prime factorizations.

For two integers \(a\) and \(b\), their greatest common divisor is denoted \(\gcd(a, b)\), or equivalently, \(\gcd(b, a).\)

For any integer \(x \neq 0\), \(\gcd(x, 0) = |x|\), which should make sense. Any positive integer divides \(0.\) The largest positive integer that divides \(x\) is its absolute value. Therefore, \(|x|\) is the largest positive integer capable of dividing both \(x\) and \(0.\)

Contents

Coprimality


Two positive integers are considered coprime (or "relatively prime") to each other if their greatest common divisor is \(1.\) Here are some notable properties that two integers will have if and only if they are coprime.

  • No prime can divide both coprime integers.
  • The least common multiple of two coprime integers is their product: \(\text{lcm}(a, b) = a \times b.\)
Logic & Proofs
IntegerRational numberInequalityReal numberTheoremProofStatementProof by exhaustionUniversal generalizationCounterexampleExistence proofExistential instantiationAxiomLogicTruthPropositionCompound propositionLogical operationLogical equivalenceTautologyContradictionLogic lawPredicateDomainQuantifierArgumentRule of inferenceLogical proofDirect proofProof by contrapositiveIrrational numberProof by contradictionProof by casesSummationDisjunctive normal form
Set Theory
SetElementEmpty setUniversal setSubsetPower setCartesian productStringBinary stringEmpty stringSet operationSet identitySet proof
Functions
FunctionFloor functionCeiling functionInverse function
Algorithms
AlgorithmPseudocodeCommandAsymptotic notationTime complexityAtomic operationBrute-force algorithm
Relations
RelationReflexive relationSymmetric relationTransitive relationRelation compositionEquivalence relationEquivalence class
Number Theory
Integer divisionLinear combinationDivision algorithmModular arithmeticPrime factorizationGreatest common divisorLeast common multiplePrimality testFactoring algorithmEuclid's theoremPrime number theoremEuclidean algorithm
Induction
Proof by inductionFibonacci sequenceProof by strong inductionWell-ordering principleSequenceFactorialRecursive definition
Combinatorics
Rule of productRule of sumBijection rulePermutationCombinationComplement ruleExperimentOutcomeSample spaceEventProbabilityProbability distributionUniform distributionMultisetSixfold wayInclusion-exclusion principlePigeonhole principle
Graph Theory
GraphWalkSubgraphRegular graphComplete graphEmpty graphCycle graphHypercube graphBipartite graphComponentEulerian circuitEulerian trailHamiltonian cycleHamiltonian pathTreeHuffman treeSubstringForestPath graphStarSpanning treeWeighted graphMinimum spanning treeGreedy algorithmPrim's algorithm
Recursion
RecursionRecursive algorithmCorrectness proofDivide-and-conquer algorithmSorting algorithmMerge sort