I am learning Ruby and doing some math stuff. One of the things I want to do is generate prime numbers.
I want to generate the first ten prime numbers and the first ten
Here's a super compact method that generates an array of primes with a single line of code.
def get_prime(up_to) (2..up_to).select { |num| (2...num).all? { |div| (num % div).positive? } } end