We know that
cosθ+isinθ=eiθ
Now,
(cosθ+isinθ)(cos2θ+isin2θ)⋯(cosnθ+isinnθ)=1⇒eiθ×ei2θ⋯×einθ=1⇒ei(1+2+⋯+n)θ=1⇒ein(n+1)θ2=1⇒cos(n(n+1)θ2)+isin(n(n+1)θ2)=1+i0
Comparing real and imaginary parts, we get
cos(n(n+1)θ2)=1, sin(n(n+1)θ2)=0⇒n(n+1)θ2=2mπ⇒θ=4mπn(n+1)∴k=4