It may not work, as If in a loop tpart comes to be ```exp(3*I*t)*t```, i.e ```t``` comes after ```exp```, then it will make p[n]=1 but wont reach ```t``` of tpart to make q[n]=1.