-- MAXScript: Output decimal numbers from 0 to 16 as Binary : N.H. 2019 for k = 0 to 16 do ( temp = "" binString = "" b = k -- While loop wont execute for zero so force string to zero if b == 0 then temp = "0" while b > 0 do ( rem = b b = b / 2 If ((mod rem 2) as Integer) == 0 then temp = temp + "0" else temp = temp + "1" ) -- Reverse the binary string for r = temp.count to 1 by -1 do ( binString = binString + temp[r] ) print binString )