Modify sequence of first N natural numbers to a given array by replacing pairs with their GCD | Function to check if array arr [ ] can be obtained from first N natural numbers or not ; Driver code ; Function Call
function isSequenceValid ( B , N ) { for ( let i = 0 ; i < N ; i ++ ) { if ( ( i + 1 ) % B [ i ] != 0 ) { document . write ( " " ) ; return ; } } document . write ( " " ) ; } let N = 4 ; let arr = [ 1 , 2 , 3 , 2 ] ; isSequenceValid ( arr , N ) ;