Let $a = \frac{\pi}{2008}$. Find the smallest positive integer $n$ such that
\[\sum_{k = 1}^n 2 \cos (k^2 a) \sin (ka)\]is an integer.
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Let $a = \frac{\pi}{2008}$. Find the smallest positive integer $n$ such that
\[\sum_{k = 1}^n 2 \cos (k^2 a) \sin (ka)\]is an integer.
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
251
Let $a = \frac{\pi}{2008}$. Find the smallest positive integer $n$ such that
\[\sum_{k = 1}^n 2 \cos (k^2 a) \sin (ka)\]is an integer.
train