We use the following definition of almost periodicity given in https://arxiv.org/pdf/math-ph/0005018.pdf

Given a bounded function $f :\mathbb Z \to\mathbb R$ we denote the set of translates of $f$ by $U_0$. The function $f$ is said to be almost periodic if $U_0$ is precompact in $\ell_\infty(\mathbb Z)$.

For instance, all periodic functions are almost periodic. If $\theta$ is an irrational angle, $f(n)=\cos(2\pi n\theta)$ is another example of an almost periodic function.

Let $\Delta_n(x)=1+2+\ldots n$ be the $n$th triangular number and $\theta$ an irrational angle. Is $f(n)=\cos(2\pi\Delta_n\theta)$ almost periodic?