#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU x = gets.to_i loop { d, m = x.divmod 4; if m == 0 then x = d else break end } 3.step(x ** 0.5, 2) do |k| kk = k * k break if x < kk loop { d, m = x.divmod kk; if m == 0 then x = d else break end } end puts x