Created
April 17, 2012 12:41
-
-
Save fakefarm/2405727 to your computer and use it in GitHub Desktop.
Euler 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
# The prime factors of 13195 are 5, 7, 13 and 29. | |
# What is the largest prime factor of the number 600851475143 ? | |
number = 24 | |
array = [] | |
# how do I iterate a number? Is that a loop? | |
array.each do |num| | |
if num % 1 == 0 | |
array << 1 | |
else num % 2 == 0 | |
array << 2 | |
end | |
end | |
puts array | |
# ERROR: undefined method `each' for 24:Fixnum (NoMethodError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment