Skip to content

Instantly share code, notes, and snippets.

@rickhull
Forked from apeiros/blurp.rb
Last active November 5, 2017 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickhull/d0b579aa08c85430b0dc82a791ff12d6 to your computer and use it in GitHub Desktop.
Save rickhull/d0b579aa08c85430b0dc82a791ff12d6 to your computer and use it in GitHub Desktop.
class Integer
def exp_of_base?(base)
return false if base <= 1
num, mod = self, 0
num, mod = num.divmod(base) until num == 1 || mod > 0
mod == 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment