NumPy ufuncLesson 40Free preview
ufunc Finding LCM
This lesson is part of NumPy · All levels
Summary
Calculates the smallest common multiple (LCD) of two integers, both scalar and array. This function is element-wise so you can count multiple pairs at once. The concept of LCM often arises in the problems of periodicity, scheduling, and fractional simplification.
Key points
- Np.lcm(a, b) returns the KPI of two integers.
- Work with the elements-wise on the pair of array elements.
- Np.lcm.reduce counts the KPK of the entire array element.
- The negative input will be normalized to its absolute value.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.