Some explanation of the context, and some more solutions, can be found at <a href="https://codegolf.stackexchange.com/q/3766" rel="nofollow">https://codegolf.stackexchange.com/q/3766</a>, including a 176 byte solution in Python.