Skip to content

Instantly share code, notes, and snippets.

@joelibaceta
Last active February 8, 2016 18:14
Show Gist options
  • Save joelibaceta/4df8c92f96d1221d86ad to your computer and use it in GitHub Desktop.
Save joelibaceta/4df8c92f96d1221d86ad to your computer and use it in GitHub Desktop.
def get_major_middle_min *numbers
(0..numbers.count-2).each |i| {numbers[i] > numbers[i+1] ? p i : } ...
# TODO
end
def get_primes x
primes=[]
(2..x).each{ |n| primes.any?{|l| n%l==0 } ? nil : primes.push(n) }
return primes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment