LCM
The least common multiple of the arguments.
Least common multipleMathWorldLeastCommonMultipleWikidataQ102761Encyclopedia of MathematicsLeast_common_multiplenLableast common multipleBritannicatopic/least-common-multipleFungrimLCM✓Fungrim entryWolfram LanguageLCM!SageMathlcm([$*,])!Rosetta CodeLeast common multipleLCM(a, b, …)least common multiple of two or more integers.Typed signatures
| Type | Package | Applies |
|---|---|---|
(any*) -> number | compute-engine | always |
(any*) -> number | number-theoryreplaces compute-engine | always |
Details
- Also called the smallest common multiple: the smallest positive integer that is a multiple of every argument.
- Paired with GCD by .
- compute-engine discards signs before computing, so .
- : 0 absorbs, since 0 is a multiple of everything but nothing else divides back into it.
- Extends to rationals: .
Examples
23 more kept as data, checked against the oraclesScope #
Over the rationals: the lcm of the numerators over the gcd of the denominators — the smallest positive rational that is an integer multiple of each
live ↗Gaussian primes of norm 41 and 13: the LCM is the first-quadrant associate of their product
live ↗A lazy Range, not a materialised List
live ↗Known value · Hand-computed: the smallest number divisible by each of 1 through 10 (same fact as the Applications row below, over List) -- an independent check that a lazy [[Range]] argument is walked element by element
Possible issues #
About
| Examples | 48 |
|---|---|
| Checked against | Wolfram Language 45 agree3 differSageMath 41 agree1 differ1 unevaluatedSymPy 20 agree13 differ2 unevaluatedmathlib4 9 agree2 errorOscar 5 agree5 errorJulia 9 agree26 errorRust 8 agree2 error |
| Crosswalk | WikipediaMathWorldWikidataEncyclopedia of MathematicsnLabBritannicaFungrimFungrim entry ×26Wolfram LanguageSageMath ×2SymPyOscarJuliaRustRosetta Code |
Implementation
wolframpackages/oracle/src/mappings.tscompute-engine extends LCM to rationals (lcm of the numerators over the gcd of the denominators); Nemo/Oscar's ZZ conversion only accepts integers, so a rational operand here is a domain gap in the mapping, not a bug on either side.
sympypackages/oracle/src/mappings.tscompute-engine extends LCM to rationals (lcm of the numerators over the gcd of the denominators); Nemo/Oscar's ZZ conversion only accepts integers, so a rational operand here is a domain gap in the mapping, not a bug on either side.
sagepackages/oracle/src/mappings.tscompute-engine extends LCM to rationals (lcm of the numerators over the gcd of the denominators); Nemo/Oscar's ZZ conversion only accepts integers, so a rational operand here is a domain gap in the mapping, not a bug on either side.
oscarpackages/oracle/src/mappings.tscompute-engine extends LCM to rationals (lcm of the numerators over the gcd of the denominators); Nemo/Oscar's ZZ conversion only accepts integers, so a rational operand here is a domain gap in the mapping, not a bug on either side.
juliapackages/oracle/src/mappings.tscompute-engine extends LCM to rationals (lcm of the numerators over the gcd of the denominators); Nemo/Oscar's ZZ conversion only accepts integers, so a rational operand here is a domain gap in the mapping, not a bug on either side.
mathlib4packages/oracle/src/mappings.tscompute-engine extends LCM to rationals (lcm of the numerators over the gcd of the denominators); Nemo/Oscar's ZZ conversion only accepts integers, so a rational operand here is a domain gap in the mapping, not a bug on either side.
rustpackages/oracle/src/mappings.tscompute-engine extends LCM to rationals (lcm of the numerators over the gcd of the denominators); Nemo/Oscar's ZZ conversion only accepts integers, so a rational operand here is a domain gap in the mapping, not a bug on either side.
sagepackages/oracle/src/mappings.ts See also: GCD