Skip to content

Instantly share code, notes, and snippets.

@rbishop
Created February 10, 2013 21:49
Show Gist options
  • Select an option

  • Save rbishop/4751187 to your computer and use it in GitHub Desktop.

Select an option

Save rbishop/4751187 to your computer and use it in GitHub Desktop.
Euler problem #3
def largest_prime_factor num
factor = 2
product = 1
while product != num
factor += 1
if num % factor == 0
product *= factor
end
end
return factor
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment