Problem

Source: 2023 Turkey TST D3 P7

Tags: function, number theory



Let us call an integer sequence $\{ a_1,a_2, \dots \}$ nice if there exist a function $f: \mathbb{Z^+} \to \mathbb{Z^+} $ such that $$a_i \equiv a_j \pmod{n} \iff i\equiv j \pmod{f(n)}$$for all $i,j,n \in \mathbb{Z^+}$. Find all nice sequences.