#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU require 'prime' x = gets.to_i y = 1 Prime.each do |p| c = 0 loop { d, m = x.divmod p if m != 0 break end c += 1 x = d } if c & 1 == 1 y *= p end if x == 1 break end end