Determine all natural numbers $n$ for which there exists a permutation $(a_1,a_2,\ldots,a_n)$ of the numbers $0,1,\ldots,n-1$ such that, if $b_i$ is the remainder of $a_1a_2\cdots a_i$ upon division by $n$ for $i=1,\ldots,n$, then $(b_1,b_2,\ldots,b_n)$ is also a permutation of $0,1,\ldots,n-1$.
Problem
Source: Bulgaria 1983 P1
Tags: Sequences, number theory
17.08.2021 17:45
Aaa finally. I actually solved a different variant of this problem by misreading it. Turns out it helped me a lot! Thanks to L567 for helping! Variant problem wrote: Determine all natural numbers $n$ for which there exists a permutation $(a_1,a_2,\ldots,a_n)$ of the numbers $0,1,\ldots,n-1$ such that, if $b_i$ is the remainder of $a_1+a_2+\cdots+ a_i$ upon division by $n$ for $i=1,\ldots,n$, then $(b_1,b_2,\ldots,b_n)$ is also a permutation of $0,1,\ldots,n-1$. Proof: So $b_i\equiv a_1+\dots + a_i\mod n.$ So $$\sum_{i=1}^n b_i=a_1+a_1+a_2+a_1+\dots+\dots +a_1+\dots +a_n\equiv n\cdot a_1+(n-1)\cdot a_2 +\dots +2\cdot a_{n-1}+a_n \mod n$$ Now, looking at $n=3$ case, we have a claim. Claim:If $a_i\ne 0,~~1<i$ Proof: If not then $b_{i-1}=b_i.$ So we want each $b_i$ to be distinct. Hence for any $k$ -consecutive $a_i,$ we have $$a_{i}+\dots+a_{i+k-1}\not\equiv 0\mod n$$ Now, clearly $n$ is even. Since, if not, then $n|\frac{n(n-1)}{2}.$ (we will have $b_1=b_n.$) Now, take $(0,n-1,2,n-3,4,n-5,\cdots)\rightarrow (0,n-1,1,n-2,2,n-3,3,\cdots).$ And we are done! original problem wrote: Determine all natural numbers $n$ for which there exists a permutation $(a_1,a_2,\ldots,a_n)$ of the numbers $0,1,\ldots,n-1$ such that, if $b_i$ is the remainder of $a_1a_2\cdots a_i$ upon division by $n$ for $i=1,\ldots,n$, then $(b_1,b_2,\ldots,b_n)$ is also a permutation of $0,1,\ldots,n-1$. Answer: Only $n=$ prime works. Proof: Clearly $a_n=0,$ since if not then $a_i=0\implies b_i,b_{i+1}, \dots=0.$ Now, $n$ should be a prime. Because if it's composite, then at least $ b_{n-1},b_n = 0.$ So, we basically have in some order, $\{1,\dots n-1\}=\{g^0,\dots, g^{n-2}\},$ where $g$ is the primitve root. And we have $n-1$ even ( we can take $n$ to be odd prime). So we can restate the statement as new statement wrote: Find all odd- prime $n$ such that for it's primitive root, there exists a permutation $g,$ $ (g^{c_1},\dots, g^{a_{n-1}})$ of the numbers $\{g,\dots, g^{n-1}\}$ such that, if $g^{b_i}= g^{c_1}\cdot g^{c_2}\cdots g^{c_i}$ for $i=1,\ldots,n,~~ 0\le b_i\le n-2,$ then $(g_1^{b_1},g_2^{b_2,}\ldots,g_n^{b_n})$ is also a permutation of $\{g,\dots, g^{n-1}\}$ . So we have $b_i=c_1+\cdot +c_i\mod n-1.$ And we want each $b_i$ to be distinct. Since $n-1$ is even, we can take $$(c_1,\dots,c_{n-1})=(0,n-2,2,n-4,4,n-6,\cdots)\implies (b_1,b_2,b-3,\dots, b_{n-1})=(0,n-2,1,n-3,2, \dots )$$ which gives $$(a_1,a_2,\ldots,a_n)=(g^0,g^{n-2},g^1,g^{n-3},\dots)$$