14 lines
335 B
Text
14 lines
335 B
Text
procedure main()
|
|
every 1 to 10 do
|
|
write(n := nextlooknsayseq(\n | 1))
|
|
end
|
|
|
|
procedure nextlooknsayseq(n) #: return next element in look and say sequence
|
|
n2 := ""
|
|
n ? until pos(0) do {
|
|
i := tab(any(&digits)) | fail # or fail if not digits
|
|
move(-1)
|
|
n2 ||:= *tab(many(i)) || i # accumulate count+digit
|
|
}
|
|
return n2
|
|
end
|