develooper Front page | perl.fwp | Postings from October 2007

A little golf?

Thread Next
From:
Anthony DeRobertis
Date:
October 11, 2007 14:14
Subject:
A little golf?
Message ID:
20071011200042.GD16440@derobert.net
$ perl test.pl
1
11
21
1211
111221
312211
13112221
1113213211
31131211131221
13211311123113112211
11131221133112132113212221
3113112221232112111312211312113211
1321132132111213122112311311222113111221131221
11131221131211131231121113112221121321132132211331222113112211
311311222113111231131112132112311321322112111312211312111322212311322113212221

1, then 11 (one "1"), then 21 (two "1"s), then 1211 (one "2", one "1"),
etc. That's the pattern.

Putting starts at 53:
	$ cat test.pl
	s//1\n/;for$i(1..15){print;s!(\d)\1*!$&=~y///c.$1!ge}

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About