we array b_1 b_2 ldot b_m good exist index j b_i cdot b_j perfect squaregiven array b_1 b_2 ldot b_m action perform follow multiply element b_i prime p divide element b_i prime p b_i divisible p let fb_1 b_2 ldot b_m minimum number action need array b goodYou give array n integer a_1 a_2 ldot a_n q query form l_i r_i for query output fa_l_i a_l_i 1 ldot a_r_i