numpy.lcm(arr1, arr2, out = None, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None):此数学函数可帮助用户计算| arr1 |的lcm值。和| arr2 |元素。

参数:
arr1 / arr2: [array_like]Input array.返回: LCM of two or more numbers.
代码:
# Python program illustrating  
# lcm() method  
import numpy as np  
  
arr1 = [120, 24, 42, 10] 
arr2 = [2250, 12, 20, 50] 
  
print ("arr1:", arr1) 
print ("arr2:", arr2) 
  
print ("\nlcm of arr1 and arr2:", np.lcm(arr1, arr2)) 
print ("\nlcm of arr1 and 10  :", np.lcm(arr1, 10)) 
                     输出:
arr1:[120, 24, 42, 10] arr2:[2250, 12, 20, 50] lcm of arr1 and arr2:[9000, 24, 420, 50] lcm of arr1 and 10 :[120, 120, 210, 10]
相关用法
注:本文由纯净天空筛选整理自Mohit Gupta_OMG 大神的英文原创作品 numpy.lcm() in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
