+ 2
13 : 2 = 6 R 1
6 : 2 = 3 R 0
3 : 2 = 1 R 1
1 : 2 = 0 R 1
1101
+ 1
Without array you can use stack frames to store partial results. I.e. think recursion. Symbolically
d2b(n) ⥠d2b(n>>1) + n&1
where d2b is a function converting decimal 2 binary.