We consider the periodic weighted operator Ty=−ρ−2(ρ2y′)′+14ρ−4 in L2(R,ρ2dx) where ρ is a 1-periodic positive function satisfying q=ρ′/ρ∈L2(0,1). The spectrum of T consists of intervals separated by gaps. In the first part of the paper we construct the Marchenko–Ostrovski mapping q→h(q) and solve the corresponding inverse problem. For our approach it is essential that the mapping h has the factorization h(q)=h0(V(q)), where q→V(q) is a certain nonlinear mapping and V→h0(V) is the Marchenko–Ostrovski mapping for the Hill operator. Moreover, we solve the inverse problem for the gap length mapping. In the second part of this paper we derive the trace formula for T.