Enhanced lcm: Least Common Multiple of N-Arguments of N Elements

Provides the least common multiple for an arbitrary number of variable-size arguments.
83 download
Aggiornato 23 feb 2016

Visualizza la licenza

Overview:
Provides the least common multiple of an arbitrary number of arguments, each with an arbitrary number of elements. Also handles the case of a single input without throwing an error by returning that input as the lcm. Multidimensional inputs will find the least common multiple of all elements used, and the computation time can grow exponentially.
Method:
The least common multiple must be a multiple of all numbers, by definition. Using that, it is simple to step through all multiples of the last input, stopping when the current multiple is divisible by all the other inputs. For prime inputs, the least common mulitple is the product of all the inputs, so this is used as an upper bound on the least common multiple.

Cita come

David Guglielmo (2025). Enhanced lcm: Least Common Multiple of N-Arguments of N Elements (https://it.mathworks.com/matlabcentral/fileexchange/55618-enhanced-lcm-least-common-multiple-of-n-arguments-of-n-elements), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2012a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Elementary Math in Help Center e MATLAB Answers
Tag Aggiungi tag
lcm

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0

Better title