Each new number is composed of digit pairs which count the consecutive occurences of digits in the last number:
1 2 1 -> 11 12 11 (one '1', one '2', one '1')
111 2 11 -> 31 12 21 (three '1's, one '2', two '1's)
3 11 22 1 -> 13 21 22 11 (one '3', two '1's, two '2's, one '1')
so the next number should be:
1 3 2 1 22 11 -> 11 13 12 11 22 21 = 111312112221
I first encountered this sequence as a method of compressing long strings of repeated numbers:
888888884444444999222222211111116644444 ->
88743972712654
Though obviously it's not a good choice for compressing something like:
123456789123456789 ->
111213141516171819111213141516171819
chr0
----
perl -le'$$=substr(%{*::}->{_},2,1);print+(map{$$++for(1..$_);$$}(2,5,10)),$|' | [reply] |
The trick is to find out what the rule is.
And what would the "rule" in your example be? And why?
I really haven't the slightest idea what this is, and what it is supposed to do, but it looks interesting
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
| [reply] |