prime
prime copied to clipboard
Prime numbers and factorization library.
I found pattern to return `Rational`. There would be more patterns if the arguments were not limited to Integer, but I assume that Prime only considers Integer.
When needed a list of unique divisors (2nd solutinon [here](https://leetcode.com/problems/split-the-array-to-make-coprime-products/solutions/3261267/1984-ms/)), creating (and destructing) a 2D array in `prime_division` is unnecessary. Creating an 1D array should be less expensive.
I want `Integer#divisors` that return the divisors of `self`. ```ruby 6.divisors # => [1, 2, 3, 6] 7.divisors # => [1, 7] 8.divisors # => [1, 2, 4, 8] ```...