Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A little golf?

3 views
Skip to first unread message

Anthony DeRobertis

unread,
Oct 11, 2007, 4:00:42 PM10/11/07
to f...@perl.org
$ 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}

Ton Hospel

unread,
Oct 11, 2007, 7:37:42 PM10/11/07
to f...@perl.org
41: print,s,(.)\1*,$&%9/$1.$1,egfor(1 .$/)x15
0 new messages