Problem

Source: St Petersburg 2022 10.5

Tags: function, number theory



Let $n$ be a positive integer and let $a_1, a_2, \cdots a_k$ be all numbers less than $n$ and coprime to $n$ in increasing order. Find the set of values the function $f(n)=gcd(a_1^3-1, a_2^3-1, \cdots, a_k^3-1)$.