Friday, April 24, 2026

Permutation with distinct prefix sums

For a permutation $x_1, x_2, \dots, x_{100}$ of $0, 1, 2, \dots, 99$ , define 

$$S_n = \left(\sum_{j=1}^{n} x_j\right) \mod 100$$

Is there a permutation such that $S_i \neq S_j $, for all $i \neq j$?

i.e $S_1, S_2, \dots, S_{100} $ is also a permutation of $0, 1, 2, \dots, 99$?

Scroll down for a surprising solution (edit: there is a nice and  much simpler solution in the comments)

.

.

.

.

.

.

We use the fact that $101$ is a prime! 

Since $101$ is a prime, it has a primitive root $g$ and we have that:

Given $ 1 \le m \le 100$, there is a unique $0 \le e_m \le 99$ such that $$g^{e_m} = m \mod 101$$.

Note also, that the $e_i$ are distinct $\mod 100$ because $g$ is a primitive root and $g^{x} = g^{x \mod 100} \mod 101$.

Now we make the following claim:

$\textbf{Claim:}$ The sequence $$\begin{aligned}&x_1 = e_1 = 0\\&x_2 = e_2 - e_1 \mod 100\\&x_n = e_n - e_{n-1} \mod 100\\ &x_{100} = e_{100} - e_{99} \mod 100 \end{aligned} $$ 

is a permutation that satisfies the distinct prefix sum property!

$\textbf{Proof:}$ 

First let's prove that $x_1, x_2, \dots, x_{100}$ is indeed a permutation of $0, 1, 2, \dots 99$.

Suppose it were not, then we must have that $x_i = x_j$ for some $i \neq j$. 

Note $x_1 = 0$ and we have that $e_{n} \neq e_{n-1} \mod 100$ (as the $e_i$ are distinct $\mod 100$). Thus we cannot have that $x_1 = x_i$ for $i \neq 1$. 

Now suppose $e_{i+1} - e_{i} = e_{j+1} - e_{j} \mod 100$ (with $0 < i, j \leq 99$). This implies that

$$g^{e_{i+1} - e_{i}} = g^{e_{j+1} - e_j} \mod 101$$

By definition, $g^{e_n} = n \mod 101$. Thus we must have that

$$ \dfrac{i+1}{i} = \dfrac{j+1}{j} \mod 101 \implies i = j \mod 101$$  

Thus $x_1, x_2, \dots, x_{100}$ is indeed a permutation of $0,1,2, \dots, 99$.

The prefix sums of the $x_i$ are just $S_n = e_1 + (e_2 - e_1) + \dots + (e_n - e_{n-1}) = e_n$.

Thus $$S_1, S_2, \dots, S_{100} = e_1, e_2, \dots, e_{100}$$

Since the $e_i$ are distinct $\mod 100$, the $S_i$ are distinct too, and we are done!


This is an original problem and this solution seems like overkill (but pretty nice if I may say so myself). If you find a simpler solution, please post in the comments.

10 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. For an even n, let x be (0, n-1, 2, n-3, 4, ..., n-4, 3, n-2, 1), where n/2 is at the middle. The sequence of prefix sums is an interesting rearrangement of x. For an odd n it is clearly impossible.

    ReplyDelete
    Replies
    1. Hey! How have you been?

      You are right, looks like it will work. Prefix sums seem to come out to be 0,-1,1,-2,2,-3,3,..., n/2.

      Nice!

      Delete
    2. I'm good, how about you? Your method is interesting, and your blog keeps me entertained :)

      Delete
    3. I am good. Glad to hear you find my blog entertaining :) I do read your blog too. You have very nice content there.

      Delete
    4. Haha, I didn't know you read it.

      Delete
    5. :) I discovered your blog when you posted your solution to the riddler hats puzzle on my friend's website.

      Delete
    6. You meant Arvind right? Somehow I lost his website, do you still have it?

      Delete
    7. Yes Arvind. This is his site: https://www.starvind.com/category/math/puzzles-problems/

      Delete