method
prime_division
prime_division()
public
Hide source
# File lib/mathn.rb, line 45 def prime_division raise ZeroDivisionError if self == 0 ps = Prime.new value = self pv = [] for prime in ps count = 0 while (value1, mod = value.divmod(prime) mod) == 0 value = value1 count += 1 end if count != 0 pv.push [prime, count] end break if prime * prime >= value end if value > 1 pv.push [value, 1] end return pv end