Check if LCM of array elements is divisible by a prime number or not | Function to check any number of array is divisible by k or not ; If any array element is divisible by k , then LCM of whole array should also be divisible . ; Driver Code
function func ( a , k ) { for ( let i = 0 ; i < a . length ; i ++ ) if ( a [ i ] % k == 0 ) return true ; return false ; } let a = [ 14 , 27 , 38 , 76 , 84 ] ; var k = 19 ; let res = func ( a , k ) ; document . write ( res ) ;