sum(k=1 to n) tg(kx)