Skip to content

Instantly share code, notes, and snippets.

@rbishop
Created February 10, 2013 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbishop/4751187 to your computer and use it in GitHub Desktop.
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