$n\ge k>r\ge0$
$$\sum_{l=0}^{\lfloor\frac{n-r}k\rfloor}\binom{n}{kl+r}=\frac{2^n}k\sum_{l=0}^{k-1}\cos^n\frac lk\pi\cos\frac{(n-2r)l}{k}\pi$$
$\zeta=\exp\left(\frac{2\pi i}{k}\right),i=\sqrt{-1}$とします.
\begin{equation*} \begin{split} &\sum_{l=0}^{\lfloor\frac{n-r}k\rfloor}\binom{n}{kl+r}\\ &= \frac1k\sum_{l=0}^{n}\binom{n}{l}\left(\sum_{j=0}^{k-1}\zeta^{j(l-r)}\right)\\ &=\frac1k\sum_{l=0}^{k-1}\zeta^{-rl}\sum_{j=0}^n\binom{n}{j}\zeta^{lj}\\ &=\frac1k\sum_{l=0}^{k-1}\zeta^{-rl}(1+\zeta^l)^n\\ &=\frac1k\sum_{l=0}^{k-1}\zeta^{-rl}\sqrt{2^n\left(1+\cos\frac{2l}k\pi\right)^n}\left(\frac{1+\cos\frac {2l}k\pi}{\sqrt{2\left(1+\cos\frac{2l}k\pi\right)}}+i \frac{\sin\frac{2l}k\pi}{\sqrt{2\left(1+\cos\frac{2l}k\pi\right)}}\right)^n\\ &=\frac1k\sum_{l=0}^{k-1}\zeta^{-rl}2^n\left|\cos^n\frac{l}{k}\pi\right|\left(\left|\cos\frac{l}k\pi\right|+i \mathrm{sgn}\left(\sin\frac{2l}k\pi\right)\left|\sin\frac{l}k\pi\right|\right)^n\\ &=\frac{2^n}{k}\left(1+\sum_{0< l<\frac k2}\zeta^{-rl}\left|\cos^n\frac{l}{k}\pi\right|\left(\cos\frac{nl}k\pi+i \sin\frac{nl}k\pi\right)\ +\sum_{\frac k2< l< k}\zeta^{-rl}\left|\cos^n\frac{l}{k}\pi\right|(-1)^n\left(\cos\frac{nl}k\pi+i \sin\frac{nl}k\pi\right)\right)\\ &=\frac{2^n}{k}\left(1+\sum_{0< l<\frac k2}\left|\cos^n\frac{l}{k}\pi\right|\left(\cos\frac{(n-2r)l}{k}\pi+i\sin\frac{(n-2r)l}{k}\pi\right)+(-1)^n\left|\cos^n\frac{k-l}{k}\pi\right|\left(\cos\frac{(n-2r)(k-l)}{k}\pi+i\sin\frac{(n-2r)(k-l)}{k}\pi\right)\right)\\&=\frac{2^n}{k}\left(1+2\sum_{0< l<\frac{k}2}\left|\cos^n\frac{l}k\pi\right|\cos\frac{(n-2r)l}k\pi\right)\\&=\frac{2^n}{k}\left(1+2\sum_{0< l<\frac{k}2}\cos^n\frac{l}k\pi\cos\frac{(n-2r)l}k\pi\right)\\& =\frac{2^n}k\sum_{l=0}^{k-1}\cos^n\frac lk\pi\cos\frac{(n-2r)l}{k}\pi \end{split} \end{equation*}
原始$n$乗根を用いれば,周期$n$の数論的関数が作れます.