MAT1750: The Cow Problem

Charlene Chu - November 10, 2017

Here is the solution to the cow problem using the built-in Mathematica function Solve.

Rest[Sort[DeleteDuplicates[(Solve[{(1/x)+(1/y)+(1/z)+(1/n)==1&& 0≤ x≤ y≤ z≤ n },{n,x,y,z},Integers]/.(_->a_) :> a )/. {n_,x_,y_,z_} :> If[x∣n&&y∣n&&z∣n,{n-1,x,y,z}]]]]//Column