Created
May 5, 2014 05:19
-
-
Save jamesmichiemo/949ee3771999a261e451 to your computer and use it in GitHub Desktop.
Project Euler: problem 3 http://projecteuler.net/problem=3
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
require 'prime' | |
p 'enter number:' | |
num = gets.chomp.to_i | |
def prime(num) | |
pfactor = num.prime_division | |
puts "The largest prime factor of #{num} is #{pfactor.last[0]}." | |
end | |
prime(num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment