How to partition the numbers 1 to $^2$ into subsets of equal cardinality and equal sum

95 Views Asked by At

I came across this question:

A farmer has 25 cows. These are numbered 1 to 25, and i-th cow gives i litres of milk. The farmer has 5 sons. How should he divide his cows among his sons such that each son gets the same number of cows, as well as the same amount of milk.

The way I found to solve this was to construct a magic square using numbers 1 to 25 to get 2 solutions - the set of rows, and the set of columns.

I was wondering if these 2 are the only solutions, and also what would be a good way to approach a generalisation of this problem, i.e.
How to partition the numbers $1$ to $k^2$ into $k$ subsets of equal cardinality and equal sum.

2

There are 2 best solutions below

0
On

If $k$ is even, then each son selects any (k/2) from the first half of the herd, and symmetrically $k^2+1-n$ from the second half of the herd.

0
On

I'm not familiar with a magic square solution and, if mine could fit into one, I don't know how. The sum of $1$-to-$25$ is $325=5\cdot65$

We can start with groupings that have the same sum of $65$ for each of $5$ sums. These are found by starting with $25$ and adding the next remaining largest number(s) that increase the sum without exceeding $65$.

$$ =25+24+16\qquad =23+22+20\qquad =21+19+18+7\\ =17+15+14+13+6\qquad =12+11+10+9+8+5+4+3+2+1$$

These are not the same cardinality. We need $5$ sums of $65$ with $5$ summands each. The $4^{th}$ sum meets this criteria. Now let's swap $16$ from the $1^{st}$ sum with $10,5,1$ from the $5^{th}$ sum.

$$ =25+24+10+5+1\qquad =23+22+20\qquad =21+19+18+7\\ =17+15+14+13+6\qquad =16+12+11+9+8+4+3+2$$

Now, let's swap $7$ form the $3^{rd}$ sum with $4,3$ from the $5^{th}$ sum. $$ =25+24+10+5+1\qquad =23+22+20\qquad =21+19+18+4+3\\ =17+15+14+13+6\qquad =16+12+11+9+8+7+2$$ Now, if we swap $20$ from the $2^{nd}$ sum with $11,7,2$ from the $5^{th}$ we get. $$=25+24+10+5+1\qquad =23+22+11+7+2\qquad =21+19+18+4+3\\ =17+15+14+13+6\qquad =20+16+12+9+8$$

And we are done. All sons have $5$ cows and each gets $65$ gallons of milk a day. There are more solutions (not sure how many) if we simply swap addends between the sums. For instance, let's swap $24,10$ with $23,11$ in the $1^{st}\;2\;$ sums. $$=25+23+11+5+1\qquad =24+22+10+7+2\qquad =21+19+18+4+3\\ =17+15+14+13+6\qquad =20+16+12+9+8$$

If we now swap $10,7$ with $9,8$ or $15,14$ with $20,9$ (not shown) we would have at least $3$ solutions so the answer to your question is "Yes, there are more than $2$."

Note: The sons do not always get the same proportion of cows from the $1^{st}$ and $2^{nd}$ halves of the herd as suggested in the earlier answer.