View primes.rb
require 'mathn' | |
# Generates a list of primes below a given value | |
def primelist(n) | |
k = 1 | |
a = [2,3] | |
while 6*k < n | |
a.push(6*k-1) | |
a.push(6*k+1) | |
k += 1 |