Created
October 28, 2018 03:21
-
-
Save ZeroPivot/b3fd93c587fa7e9a3a7c1630c3a282d4 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
def fnumero(string:) | |
words=string.split("") | |
numero=words.inject(0){|result, element| result.ord + element.ord} | |
while (numero.to_s.split("").length > 1) do | |
break if numero % 11==0 | |
numero=numero.to_s.split("").inject(0){|result, element| result.to_i + element.to_i} | |
end | |
return numero | |
end | |
puts "wuff: #{fnumero(string: "wuff")}" | |
puts "ArityWolf: #{fnumero(string: "ArityWolf")}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment