Quantcast
Channel: All about basic binary - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 23

Answer by edc65 for All about basic binary

$
0
0

JavaScript (ES6) 65

68 bytes for a function with a parameter and console output.

f=n=>{s=n=>n%b>1||b<n&&s(n/b|0);for(b=1;b++<n;)s(n)||console.log(b)}

65 bytes with I/O via popup

n=prompt(s=n=>n%b>1||b<n&&s(n/b|0));for(b=1;b++<n;)s(n)||alert(b)

Claiming the bonus: 88*0.75 => 66

n=prompt(s=n=>n%b>1?9:(b<=n?s(n/b|0):'')+n%b);for(b=1;b++<n;)s(n)<'9'&&alert(b+''+s(n))

Viewing all articles
Browse latest Browse all 23

Trending Articles