Let $n \in \mathbb{Z}$. We compute for $k \ge 2$,
$$ s_k \equiv {n(n+1) \over 2} \bmod{k} \tag 1 $$
$$ c_{k} = c_{k-1} + s_k \tag 2 $$
The RHS in Eqn. (1) can be readily recognized as the sum of first $n$ natural numbers, modulo $k$.
Eqn. (2) computes the ordinary cumulative sum of the modular sums $s_k$.
There seems to be a pattern where a factor of $n$ can be detected:
- at an even step $k$.
- $k$ is smaller than the smallest factor of $n$.
Is this a known phenomena? Can we say anything about the number of steps $k$ in which we can detect a factor?
Here are a few examples:


