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,15 @@
defmodule RC do
require Integer
def zigzag(n) do
fmt = "~#{to_char_list(n*n-1) |> length}w "
(for x <- 1..n, y <- 1..n, do: {x,y})
|> Enum.sort_by(fn{x,y}->{x+y, if(Integer.is_even(x+y), do: y, else: x)} end)
|> Enum.with_index |> Enum.sort
|> Enum.each(fn {{_x,y},i} ->
:io.format fmt, [i]
if y==n, do: IO.puts ""
end)
end
end
RC.zigzag(5)