Binary is easy, just iterate it once.
0 = 0
1 = 1
2 = 10
3 = 11
4 = 100
5 = 101
6 = 110
7 = 111
8 = 1000
and so on.
In base 10 the right most columns are 1s, with up to nine of them. The second are 10s with up to nine of them. So 89 is 8 tens, and 9 ones. Each column to the left multiplies the previous one by 10.
In binary, each column to the left multiplies the previous by 2. So the rightmost column are 1s (up to 1 of them), the next are 2s (up to 1 one of them), the next are 4s (up to 1 of them) and so one.