Algolib
Data structures
Graphs
Geometry
Mathematics
Exponentiation by squaring
Fraction
GCD / LCM
getGCD()
getGCDBezout()
getLCM()
Matrix
Modulo
Permutation
Polynomial
Prime decomposition
Sieve of Eratosthenes
Optimization
Sorting
Strings
Trees
Simplex
Two-SAT
JSON
Constants
Shortcuts
Utility
Algolib
Mathematics
GCD / LCM
View page source
GCD / LCM
Functions
long
long
getGCD
(
long
long
a
,
long
long
b
)
std
::
array
<
long
long
,
3
>
getGCDBezout
(
long
long
a
,
long
long
b
)
Returns {gcd, u, v} such that gcd = a*u + b*v.
long
long
getLCM
(
long
long
a
,
long
long
b
)