Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save alvinkatojr/6230135 to your computer and use it in GitHub Desktop.

Select an option

Save alvinkatojr/6230135 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
n = 2..1000
o = []
p = []
for i in n
next if o.include? i
ii = i * 2
while ii <= n.last do
o << ii
ii = ii + i
end
p << i unless o.include?(i)
end
puts p.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment