Skip to content

Instantly share code, notes, and snippets.

@oscardelben
Created March 17, 2009 11:09
Show Gist options
  • Save oscardelben/80466 to your computer and use it in GitHub Desktop.
Save oscardelben/80466 to your computer and use it in GitHub Desktop.
class Integer
# overwritten, I don't need modulus
def sum_progression
self * (self + 1) / 2
end
def integral_divisors_size
factors = self.factors
result = 1
factors.uniq.each do |prime|
result *= (factors.count(prime) + 1)
end
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment