Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created May 5, 2014 05:19
Show Gist options
  • Save jamesmichiemo/949ee3771999a261e451 to your computer and use it in GitHub Desktop.
Save jamesmichiemo/949ee3771999a261e451 to your computer and use it in GitHub Desktop.
Project Euler: problem 3 http://projecteuler.net/problem=3
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