Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,27 @@
generate_seq := proc(s)
local times, output, i;
times := 1;
output := "";
for i from 2 to StringTools:-Length(s) do
if (s[i] <> s[i-1]) then
output := cat(output, times, s[i-1]);
times := 1; # re-assign
else
times ++;
end if;
end do;
cat(output, times, s[i - 1]);
end proc:
Look_and_Say :=proc(n)
local value, i;
value := "1";
print(value);
for i from 2 to n do
value := generate_seq(value);
print(value);
end do;
end proc:
#Test:
Look_and_Say(10);