Will this work and/or what should I do to improve it?

n = 2
peter = gets
until n > peter**0.5
if peter % n == 0
peter = peter / n
n = 2
else
n = n + 1
end
end
print peter