Julia, 72 70 bytes
It's actually longer with the bonus, so no bonus here.
n=int(readline());for j=2:n all(i->i∈0:1,digits(n,j))&&println(j)endThis reads a line from STDIN, converts it to an integer, and prints the result. Despite being a brute force method, the input 1234321 took less than 1 second for me.
Ungolfed + explanation:
# Read n from STDIN and convert to integern = int(readline())# For every potential base from 2 to nfor j = 2:n # If all digits of n in base j are 0 or 1 if all(i -> i ∈ 0:1, digits(n, j)) # Print the base on its own line println(j) endendExamples:
julia> n=int(readline());for j=2:n all(i->i∈0:1,digits(n,j))&&println(j)end12343212111112343201234321julia> n=int(readline());for j=2:n all(i->i∈0:1,digits(n,j))&&println(j)end8200023458199982000NOTE: If input can be taken as a function argument rather than from STDIN (awaiting confirmation from the OP), the solution is 55 bytes.




