# require 'Math'
class Prime
def calc
i = 1
j = 1
max = 1
limit = 600851475143
for i in 2..limit
prime = true
for j in 2..Math.sqrt(i)
if i%j==0
prime = false
break
end
end
if prime == true
if limit % i == 0
if i>max
max = i
end
end
end
end
return max
end
end
num = Prime.new
print num.calc
IyByZXF1aXJlICdNYXRoJwpjbGFzcyBQcmltZQoJZGVmIGNhbGMKCQlpID0gMQoJCWogPSAxCQoJCW1heCA9IDEKCQlsaW1pdCA9IDYwMDg1MTQ3NTE0MwoJCWZvciBpIGluIDIuLmxpbWl0CgkJCXByaW1lID0gdHJ1ZQoJCQlmb3IgaiBpbiAyLi5NYXRoLnNxcnQoaSkKCQkJCWlmIGklaj09MCAKCQkJCQlwcmltZSA9IGZhbHNlCgkJCQkJYnJlYWsKCQkJCWVuZAoJCQllbmQKCQkJaWYgcHJpbWUgPT0gdHJ1ZSAKCQkJCWlmIGxpbWl0ICUgaSA9PSAwCgkJCQkJaWYgaT5tYXgKCQkJCQkJbWF4ID0gaQkJCQkJCQkKCQkJCQllbmQgICAKCQkJCWVuZAoJCQllbmQJCQkJCgkJZW5kCglyZXR1cm4gbWF4CQoJZW5kCQplbmQKCm51bSA9IFByaW1lLm5ldwpwcmludCBudW0uY2FsYw==