MAT1750: The Cow Problem (Leonard)

Charlene Chu - November 5, 2017

Problem

A farmer has 19 cows, and she wishes to give them to her daughters so that the first will get (1/2), the second will get (1/4), and the third (1/5). This is obviously impossible. A wise woman hears of the problem and suggests: “I’ll add on one of my cows, so you’ll have 20. The first daughter will get 10, the second 5, the third 4, I’ll take back the remaining cow, and everyone is happy!”.
Problem. Are there any other quadruples like (19,2,4,5), for which the same trick will work? What are all of them?
Hint. It is sometimes better to analyze and generalize first.

Solution

We would like to find n,x,y,z ϵ (SubPlus[ℤ]) such that n+1=((n+1)/x)+((n+1)/y)+((n+1)/z)+1 where ((n+1)/k)ϵ ℤ for k=x,y,z. This is equivalent to finding a,b,c ϵ (SubPlus[ℤ]) such that ((a+b+c+1)/a),((a+b+c+1)/b),((a+b+c+1)/c)ϵ ℤ. Thus, giving us n=a+b+c, x=((a+b+c+1)/a),y=((a+b+c+1)/b),z=((a+b+c+1)/c).

From the above example, we have n=19,x=2,y=4,z=5,a=10,b=5,c=4.

CowProblem[m] returns a list of solutions {n,x,y,z} to the cow problem for integers n≤ m.

crit[l_List]:= Module[{a,b,c},a=l[[1]];b=l[[2]];c=l[[3]];
IntegerQ[((a+b+c+1)/a)]&&IntegerQ[((a+b+c+1)/b)]&&IntegerQ[((a+b+c+1)/c)]];
CowProblem[m_Integer] :=Module[{p={}},
Do[p=Join[p,IntegerPartitions[i,{3}]],{i,3,m}];
Select[p,crit]/.{a_Integer,b_Integer,c_Integer}:> {a+b+c,((a+b+c+1)/a),((a+b+c+1)/b),((a+b+c+1)/c)}];

Answer

Yes, there are other quadruples like (19,2,4,5), for which the same trick will work. Since Dror and Leonard says there are only 12 of them, we will not exhaust our possibilities. Here are the 12 quadruples below.

answ =CowProblem[(10^2)]

We can check our answers by observing the following table.

Join[{{"n","x","y","z","n+1=((n + 1)/x)+((n + 1)/y)+((n + 1)/z)+1?"}},(answ/.{n_,x_,y_,z_}:>{n,x,y,z,n+1==((n+1)/x)+((n+1)/y)+((n+1)/z)+1})]//TableForm