Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2014 19:03
Show Gist options
  • Save anonymous/10674787 to your computer and use it in GitHub Desktop.
Save anonymous/10674787 to your computer and use it in GitHub Desktop.
factor = []
array = [2, 4, 5, 7, 11, 10]
array.each{|x|
y = 2
while y < x
if x % y == 0
factor << y
end
y = y +1
end
if factor.length != 0
array[x] = 0
end
}
puts factor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment