Skip to content

Instantly share code, notes, and snippets.

View xjunior's full-sized avatar
🏠
Working from home

Carlos Palhares xjunior

🏠
Working from home
View GitHub Profile
@xjunior
xjunior / Crivo de Eratóstenes
Created April 11, 2011 19:36
Sieve of Eratosthenes is an algorithm to find prime numbers from 2 to a given number.
## Code
module Crivo
def self.gera_primos(til)
list = (2..til).to_a
list.each do |pivot|
list = remove_multiples(list, pivot)
end
list
end