Problem

Source: India IMOTC 2024 Day 2 Problem 1

Tags: abstract algebra, number theory



Let $n$ be a positive integer. Let $s: \mathbb N \to \{1, \ldots, n\}$ be a function such that $n$ divides $m-s(m)$ for all positive integers $m$. Let $a_0, a_1, a_2, \ldots$ be a sequence such that $a_0=0$ and \[a_{k}=a_{k-1}+s(k) \text{ for all }k\ge 1.\]Find all $n$ for which this sequence contains all the residues modulo $(n+1)^2$. Proposed by N.V. Tejaswi