Skip to content

Instantly share code, notes, and snippets.

@ZeroPivot
Created October 28, 2018 03:21
Show Gist options
  • Save ZeroPivot/b3fd93c587fa7e9a3a7c1630c3a282d4 to your computer and use it in GitHub Desktop.
Save ZeroPivot/b3fd93c587fa7e9a3a7c1630c3a282d4 to your computer and use it in GitHub Desktop.
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