## JavaScript (ES6), <s>35</s> 34 bytes f=n=>n?[...f(n>>=1),!n|n%2||-1]:[] ### Test snippet <!-- begin snippet: js hide: true console: true babel: true --> <!-- language: lang-js --> let f=n=>n?[...f(n>>=1),!n|n%2||-1]:[]; [25, 47, 1, 3, 1234567].map(x => console.log(x + ":", JSON.stringify(f(x)))) <!-- end snippet -->