Quantcast
Viewing latest article 20
Browse Latest Browse All 23

Answer by KSab for All about basic binary

Python 2, 88 86 80

Fairly straightforward, no bonus. Python is nice and lenient with global variables.

N=input();g=lambda n:n<1or(n%b<2)*g(n/b)for b in range(2,N+1): if g(N):print b

Best I've managed to get for the bonus is 118*.75 = 87.75:

N=input();g=lambda n:0**n*" "or" "*(n%b<2)and(g(n/b)+`n%b`)*(g(n/b)>'')for b in range(2,N+1): if g(N):print`b`+g(N)

Viewing latest article 20
Browse Latest Browse All 23

Trending Articles