in reply to Re: Re: 123 Digit Counter
in thread 123 Digit Counter

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)),$|'