The Horrible Histories song "Learn Your Hieroglyphics" mentions a fanmade number system. Numbers are written as a sum of 10's ("hoops") and 1's ("eyes"), for example 99 is
hoop hoop hoop hoop hoop hoop hoop hoop hoop eye eye eye eye eye eye eye eye eye
. Then, I thought, why not turn this into some sort of binary code?
Your programs should take a nonnegative integer as input.
Then, it should create a string of alternating 1's and 0's, with each group of the same digit corresponding to a digit in the number, in bijective decimal. This is so every number has a unique representation.
Examples:
0 -> empty string 1 -> 1 2 -> 11 9 -> 111111111 10 -> 1111111111 11 -> 10 19 -> 1000000000 20 -> 10000000000 99 -> 111111111000000000 100 -> 1111111110000000000 110 -> 11111111110000000000 111 -> 101 123 -> 100111 4567 -> 1111000001111110000000
Then, the strings are interpreted as a binary number, then that number is outputted.
Examples:
0 -> 0 1 -> 1 2 -> 3 9 -> 511 10 -> 1023 11 -> 2 19 -> 512 20 -> 1024 99 -> 261632 100 -> 523264 110 -> 1047552 111 -> 5 123 -> 39 4567 -> 3940224
This is code-golf , so fewest bytes wins!