Skip to content

Instantly share code, notes, and snippets.

View sghael's full-sized avatar

Sandeep Ghael sghael

  • Brookline, MA
View GitHub Profile
@sghael
sghael / it.rb
Last active August 29, 2015 13:56 — forked from anonymous/it.rb
def it(n)
x = [*2..n]
x.each do |i|
[*(i+1)..n].each { |j| x.delete(j) if (j%i).zero? }
end
end
# 1) what does it do?
# 2) how fast is it?
# 3) can you make it faster?