22
4
The look and say sequence is a basic form of run length encoding.
The sequence starts with the number 1 and each additional number encodes the number of digits that are repeated before each digit sequence. For example, "1" becomes "11", because there is one "1". Then "11" becomes "21", and so on.
The first few numbers are 1, 11, 21, 1211, 111221, 312211 and 13112221.
Write a program to output the first 20 numbers.
The catch is you may not use any number in your program, including other bases than base 10. You can only use letters and symbols. Also, the program can't directly contain the numbers (or fetch them from a web server, or from a file); it must actually compute them.
I will accept the answer which works and is the shortest; in case of a tie, vote counts will decide, and in case of a tie there, the winner will be chosen randomly.
1By "number" do you mean "character 0-9" or "numeric literal"? – Peter Taylor – 2011-04-28T15:18:04.473
@Peter Taylor: I suppose the former. It would be way too easy otherwise. – Lowjacker – 2011-04-28T15:22:39.587
5As per the FAQ, all questions on this site should have an objective primary winning criterion. – Nabb – 2011-04-28T15:32:17.727
1
Previously on Stack Overflow as Code Golf: Morris Sequence.
– dmckee --- ex-moderator kitten – 2011-04-28T16:30:47.407@Thomas: My inclination here is to close this as based on too subjective a criterion. Discussion on meta that may be relevant.
– dmckee --- ex-moderator kitten – 2011-04-28T16:33:10.790Will edit it soon. Getting a lot of error messages when trying to change the criterion. Here it is for reference: "I will accept the answer which works and is the shortest; in case of a tie, vote counts will decide, and in case of a tie there, the winner will be chosen randomly." – Thomas O – 2011-04-28T23:56:26.937
What restrictions are there on the output format? In particular, is superfluous whitespace allowed? – Peter Taylor – 2011-04-30T13:09:40.460
@Peter Taylor, you can output it in any way, provided the numbers appear in some obvious fashion (e.g. on every line, separated with commas... etc.) – Thomas O – 2011-05-01T22:33:31.580