I can write a function to find LCM (lowest common multiple) of an array of integers, but I thought it must have been implemented in numpy or scipy and was expecting something like numpy.lcm() to do that. I'm surprised to find there is no such thing. Perhaps I'm searching in a wrong place. So, if you know any other library where this simple function is defined, please oblige.
LCM builtin in Python / Numpy
python;scipy;numpy
Why not define it yourself, as suggest in the Rosetta Code examples here:http://rosettacode.org/wiki/Least_common_multiple#PythonFor example, you could build on this (via this library):import fractionsdef lcm(a,b): return abs(a * b) / fractions.gcd(a,b) if a and b else 0