Skip to content

Instantly share code, notes, and snippets.

@sammylupt
Last active February 12, 2016 16:43
Show Gist options
  • Save sammylupt/bcaee8c805fdcdf59b62 to your computer and use it in GitHub Desktop.
Save sammylupt/bcaee8c805fdcdf59b62 to your computer and use it in GitHub Desktop.
defmodule HappyNumberFinder do
# def get_sum(number)
def find(number) do
_find(number, [])
end
defp _find(number, guesses) do
sum = get_sum(number)
case sum do
1 -> {:happy}
_ -> _find(sum, [sum | guesses])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment