function to find the position of rightmost set bit
function getPosOfRightmostSetBit ( n ) { return ( ( Math . log10 ( n & - n ) ) / ( Math . log10 ( 2 ) ) ) + 1 ; } function setRightmostUnsetBit ( n ) {