Simplify Enumerable#occurences and Math.primes