This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prime?(n) | |
(2..(n-1)).each { |x| return false if n % x==0 } | |
return true | |
end | |
def tree(number, largest_prime) | |
if prime?(number) | |
largest_prime = number unless number < largest_prime | |
return largest_prime #Where I think the problem is | |
end |