Last active
February 12, 2016 16:43
-
-
Save sammylupt/bcaee8c805fdcdf59b62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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