2 of 2 added 545 characters in body

## axo, 13 bytes

[:|[1+{#;1;-_


Try it online!

### Explanation

This started out as a port of an alternative solution in my Wumpus answer:

2%)[=]&=[O00.


This resulted in 18 bytes. I ended up golfing it down to the 13 bytes you see above to adjust it more to the way axo works. This 13-byte version then ended up inspiring the improvement down to 11 bytes in Wumpus, so now it's actually closer to that version.

As in Wumpus, in iteration i, the bottom of the stack holds a(i)-1 and the top holds the first element of the ith run, but we're working with 0 and 1 throughout, except for printing.

[:    Store a copy of the top of the stack in register A.
|     Pull up a(i)-1 from the bottom of the stack.
[1+{  Print a(i).
#;    If a(i)-1 is 1, push the value in register A.
1;-   Push another copy of that value and subtract it from 1 to swap
0 and 1 for the next run.
_     Jump back to the beginning of the program.

 answered Mar 6 '18 at 23:47 Martin Ender 184k6161 gold badges407407 silver badges892892 bronze badges