For what values of $n$ is it possible to divide into three piles of equal weight? For $n \in \mathbb{N},n \geq 3$ we consider $n$ weights where the $k^{th}$ weight has a weight of precisely $k$ grams. For what values of $n$ is it possible to divide into three piles of equal weight?
My work
It is obvious that $\sum_{i=1}^n i= n(n+1)/2$ should divide $3$. This means $n\equiv 0,2 \pmod 3$.
But how do I show this for all such numbers?
Eg. $n=5 \Rightarrow \{1,4\},\{2,3\},\{5\}$
 A: My intuition, on seeing this problem, is as follows:


*

*there are a very large number of ways to divide the set $\{1, 2, 3, \ldots, n\}$ into three piles;

*there aren't that many possible different sums;

*so it should be possible to get the sums we want, unless there's some obvious reason that we can't, like divisibility.


Now I observe that if I have six consecutive integers $k, k + 1, k + 2, k + 3, k + 4, k + 5$, then I can break them up into three pairs each summing to $2k + 5$:
$$ 2k + 5 = (k + 5) + k  = (k + 4) + (k + 1 ) = (k + 3) + (k + 2). $$
So if I can divide the set $\{ 1 , 2, \ldots, n \}$ into three sets of equal weight, then I can do so for $n + 6, n + 12, \ldots$.  The hard part now is finding solutions for enough small values of $n$.
As you've observed it's doable for $n = 5$, with the partition $\{1, 4 \}, \{2, 3\}, \{ 5 \}$.  You can then add 6 and 11 to one part, 7 and 10 to a second, and 8 and 9 to a third (in any order) to get a solution for $n = 11$.
Can you find solutions for $n = 6, 8, 9$?
A: If $n=9 \Rightarrow \{9,6\},\{8,7\},\{1,2,3,4,5\}$
I did this by folowing a simple algorithm :
Let $n \in \mathbb{N}$ (verifying the condition) we consider the set $A =\{1,2,...,n\}$
Let $S_1 ,S_2, S_3$ be the three subsets of A we're looking for.
We use the notation :  $sum(S)= \sum_{i\in S}i$
Then we proceed like this for the two first sets $S_1,S_2$ :


*

*if $sum(S_i)<{n\over3} $ :

*
*

*if $sum(S_i)+max(A)<{n\over3}$ :


*
*

*
*

*We move $max(A)$ from $A$ into $S_i$



*
*

*else :


*
*

*
*

*We move ${n\over 3} - sum(S_i)$ from $A$ into $S_i$




Then we will have $S_3 = A$ ( remember each time we added an element to a previous set we deleted it from A )
I hope this helps =)
