Skip to content

Instantly share code, notes, and snippets.

@stefanroex
Created June 30, 2013 16:06
Show Gist options
  • Save stefanroex/5895757 to your computer and use it in GitHub Desktop.
Save stefanroex/5895757 to your computer and use it in GitHub Desktop.
Cocos
defmodule Cocos do
def test_amount x do
if check_division x, 7 do
x
else
test_amount x + 1
end
end
defp check_division _, 0 do
true
end
defp check_division n, m do
if rem(n, 7) == 1 do
check_division div(n, 7), m - 1
end
end
end
IO.puts Cocos.test_amount(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment