#codelife
This is my blog about learning to program.
Thursday, May 15, 2014
largest_prime_factor:1: syntax error, unexpected end-of-input
number = 600851475143
largest_factor = 0
(0..number).each do |x|
if number % x == 0
if x == 2 || (x % 2 != 0)
prime_factor = x
if prime_factor > largest_factor
largest_factor = prime_factor
end
end
end
end
1 comment:
Robert Lee
May 17, 2014 at 10:24 AM
...dividing by zero is always a winner.
Reply
Delete
Add comment
Load more...
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)

...dividing by zero is always a winner.

ReplyDelete