## Periodic sequences from cosine sums.

Mathematica:

In[292]:= len = 24;
nn = 1;
Table[Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]
nn = 2;
Table[Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]
nn = 3;
Table[Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]
nn = 4;
Table[Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]

Out[294]= {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1}

Out[296]= {0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, \
2, 0, 2, 0, 2}

Out[298]= {0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, \
0, 3, 0, 0, 3}

Out[300]= {0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, \
4, 0, 0, 0, 4}

In[301]:= len = 24;
nn = 1;
Table[n/nn^2*Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]
nn = 2;
Table[n/nn^2*Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]
nn = 3;
Table[n/nn^2*Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]
nn = 4;
Table[n/nn^2*Sum[Cos[n*(k – 1)/nn*2*Pi], {k, 1, nn}], {n, 1, len}]

Out[303]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, \
18, 19, 20, 21, 22, 23, 24}

Out[305]= {0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, \
10, 0, 11, 0, 12}

Out[307]= {0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, \
0, 7, 0, 0, 8}

Out[309]= {0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, \
5, 0, 0, 0, 6}