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
- brain
- javascript
Mathematical solution for the first challenge
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); }
Log in or sign up for Devpost to join the conversation.