text: Program to find the product of a number with a Mersenne Number | Function to find prodcut of a Mersenne number with another number ; Stores the power of 2 of integer M + 1 ; Return the product ; Driver code
code: function multiplyByMersenne ( N , M ) { let x = ( Math . log ( M + 1 ) / Math . log ( 2 ) ) ; return ( ( N << x ) - N ) ; } let N = 4 ; let M = 15 ; document . write ( multiplyByMersenne ( N , M ) ) ;