var calc = function (n) { // 2(n - 2 log 2^n) + 1 var result = 2*(n - Math.pow(2, Math.floor(Math.log(n) / Math.log(2))) ) + 1; console.info(result); }

Built With

Share this project:

Updates