defmodule Test do import Caustic.Utils import Enum @moduledoc false def start do m = 14 elems = 0..(m - 1) |> filter(&(gcd(m, &1) == 1)) totient = count elems table = elems |> map(fn a -> 2..totient |> map(&pow_mod(a, &1, m)) end) col_labels = 2..totient |> map(& "a^#{&1}") IO.puts("m = #{m}") IO.puts("φ(m) = #{totient}") print_table(table, elems, col_labels) IO.puts("") table2 = elems |> map(fn a -> elems |> map(& mod(a * &1, m)) end) print_table(table2, elems, elems) end end