Skip to content

Instantly share code, notes, and snippets.

@modalsoul
Created March 7, 2014 14:10
Show Gist options
  • Save modalsoul/9412164 to your computer and use it in GitHub Desktop.
Save modalsoul/9412164 to your computer and use it in GitHub Desktop.
defmodule Crypt do
def encrypt(numbers) do
min = Enum.min(numbers)
(product(numbers, 1)/min)*(min + 1)
end
def product([h|t],res), do: product(t, res * h)
def product([],res), do: res
end
IO.puts to_string(Crypt.encrypt([1,2,3]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment