Look-and-say sequence: Difference between revisions
Content deleted Content added
imported>Maxima enthusiast |
Not a robot (talk | contribs) add SETL |
||
Line 5,065: | Line 5,065: | ||
</pre> |
</pre> |
||
=={{header|SETL}}== |
|||
<syntaxhighlight lang="setl">program looksay; |
|||
s := "1"; |
|||
loop for i in [1..10] do |
|||
print(s); |
|||
s := looksay(s); |
|||
end loop; |
|||
proc looksay(s); |
|||
loop for c in s do; |
|||
if cur /= c then |
|||
if count /= om then |
|||
r +:= count + cur; |
|||
end if; |
|||
cur := c; |
|||
count := 1; |
|||
else |
|||
count +:= 1; |
|||
end if; |
|||
end loop; |
|||
r +:= count + cur; |
|||
return r; |
|||
end proc; |
|||
end looksay;</syntaxhighlight> |
|||
{{out}} |
|||
<pre>1 |
|||
11 |
|||
21 |
|||
1211 |
|||
111221 |
|||
312211 |
|||
13112221 |
|||
1113213211 |
|||
31131211131221 |
|||
13211311123113112211</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
{{trans|Perl}} |
{{trans|Perl}} |