(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 11448, 352] NotebookOptionsPosition[ 10719, 323] NotebookOutlinePosition[ 11084, 339] CellTagsIndexPosition[ 11041, 336] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"the", " ", "initial", " ", "amounts"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"amounts", "=", RowBox[{"{", RowBox[{ "a", ",", "b", ",", "c", ",", "d", ",", "e", ",", "f", ",", "g"}], "}"}]}], ";"}], " ", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"ii", "=", "1"}], ",", RowBox[{"ii", "\[LessEqual]", RowBox[{"Length", "[", "amounts", "]"}]}], ",", RowBox[{"ii", "++"}], ",", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"ii", " ", "wins", " ", "the", " ", "game"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"amountToPay", "=", RowBox[{ RowBox[{"Total", "[", "amounts", "]"}], "-", RowBox[{"amounts", "[", RowBox[{"[", "ii", "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"amounts", "[", RowBox[{"[", "ii", "]"}], "]"}], "=", RowBox[{ RowBox[{"amounts", "[", RowBox[{"[", "ii", "]"}], "]"}], "-", "amountToPay"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"jj", "=", "1"}], ",", RowBox[{"jj", "\[LessEqual]", RowBox[{"Length", "[", "amounts", "]"}]}], ",", RowBox[{"jj", "++"}], ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{"jj", "!=", "ii"}], ",", RowBox[{ RowBox[{"amounts", "[", RowBox[{"[", "jj", "]"}], "]"}], "*=", "2"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"Simplify", "[", "amounts", "]"}], "]"}]}]}]}], "\[IndentingNewLine]", "]"}]}]}]], "Input", CellChangeTimes->{{3.598781997748909*^9, 3.598782004279909*^9}, { 3.598786496333909*^9, 3.598786504861909*^9}, {3.598787105694909*^9, 3.598787207000209*^9}, {3.5987872435449095`*^9, 3.5987872824647093`*^9}, { 3.598787322170409*^9, 3.598787478042409*^9}, {3.598788750070009*^9, 3.598788778477809*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"a", "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ",", RowBox[{"2", " ", "b"}], ",", RowBox[{"2", " ", "c"}], ",", RowBox[{"2", " ", "d"}], ",", RowBox[{"2", " ", "e"}], ",", RowBox[{"2", " ", "f"}], ",", RowBox[{"2", " ", "g"}]}], "}"}]], "Print", CellChangeTimes->{{3.598787471078409*^9, 3.598787478745409*^9}, { 3.5987887548729095`*^9, 3.598788779513809*^9}, 3.598800362923509*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"2", " ", RowBox[{"(", RowBox[{ "a", "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "a"}], "+", RowBox[{"3", " ", "b"}], "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ",", RowBox[{"4", " ", "c"}], ",", RowBox[{"4", " ", "d"}], ",", RowBox[{"4", " ", "e"}], ",", RowBox[{"4", " ", "f"}], ",", RowBox[{"4", " ", "g"}]}], "}"}]], "Print", CellChangeTimes->{{3.598787471078409*^9, 3.598787478745409*^9}, { 3.5987887548729095`*^9, 3.598788779513809*^9}, 3.5988003629255095`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"4", " ", RowBox[{"(", RowBox[{ "a", "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "2"}], " ", RowBox[{"(", RowBox[{"a", "-", RowBox[{"3", " ", "b"}], "+", "c", "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "a"}], "-", "b", "+", RowBox[{"7", " ", "c"}], "-", "d", "-", "e", "-", "f", "-", "g"}], ",", RowBox[{"8", " ", "d"}], ",", RowBox[{"8", " ", "e"}], ",", RowBox[{"8", " ", "f"}], ",", RowBox[{"8", " ", "g"}]}], "}"}]], "Print", CellChangeTimes->{{3.598787471078409*^9, 3.598787478745409*^9}, { 3.5987887548729095`*^9, 3.598788779513809*^9}, 3.5988003629275093`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"8", " ", RowBox[{"(", RowBox[{ "a", "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "4"}], " ", RowBox[{"(", RowBox[{"a", "-", RowBox[{"3", " ", "b"}], "+", "c", "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "2"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "-", RowBox[{"7", " ", "c"}], "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "a"}], "-", "b", "-", "c", "+", RowBox[{"15", " ", "d"}], "-", "e", "-", "f", "-", "g"}], ",", RowBox[{"16", " ", "e"}], ",", RowBox[{"16", " ", "f"}], ",", RowBox[{"16", " ", "g"}]}], "}"}]], "Print", CellChangeTimes->{{3.598787471078409*^9, 3.598787478745409*^9}, { 3.5987887548729095`*^9, 3.598788779513809*^9}, 3.598800362929509*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"16", " ", RowBox[{"(", RowBox[{ "a", "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "8"}], " ", RowBox[{"(", RowBox[{"a", "-", RowBox[{"3", " ", "b"}], "+", "c", "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "4"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "-", RowBox[{"7", " ", "c"}], "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "2"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "+", "c", "-", RowBox[{"15", " ", "d"}], "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "a"}], "-", "b", "-", "c", "-", "d", "+", RowBox[{"31", " ", "e"}], "-", "f", "-", "g"}], ",", RowBox[{"32", " ", "f"}], ",", RowBox[{"32", " ", "g"}]}], "}"}]], "Print", CellChangeTimes->{{3.598787471078409*^9, 3.598787478745409*^9}, { 3.5987887548729095`*^9, 3.598788779513809*^9}, 3.598800362930509*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"32", " ", RowBox[{"(", RowBox[{ "a", "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "16"}], " ", RowBox[{"(", RowBox[{"a", "-", RowBox[{"3", " ", "b"}], "+", "c", "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "8"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "-", RowBox[{"7", " ", "c"}], "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "4"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "+", "c", "-", RowBox[{"15", " ", "d"}], "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "2"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "+", "c", "+", "d", "-", RowBox[{"31", " ", "e"}], "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "a"}], "-", "b", "-", "c", "-", "d", "-", "e", "+", RowBox[{"63", " ", "f"}], "-", "g"}], ",", RowBox[{"64", " ", "g"}]}], "}"}]], "Print", CellChangeTimes->{{3.598787471078409*^9, 3.598787478745409*^9}, { 3.5987887548729095`*^9, 3.598788779513809*^9}, 3.5988003629325094`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"64", " ", RowBox[{"(", RowBox[{ "a", "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "-", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "32"}], " ", RowBox[{"(", RowBox[{"a", "-", RowBox[{"3", " ", "b"}], "+", "c", "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "16"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "-", RowBox[{"7", " ", "c"}], "+", "d", "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "8"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "+", "c", "-", RowBox[{"15", " ", "d"}], "+", "e", "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "4"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "+", "c", "+", "d", "-", RowBox[{"31", " ", "e"}], "+", "f", "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "2"}], " ", RowBox[{"(", RowBox[{"a", "+", "b", "+", "c", "+", "d", "+", "e", "-", RowBox[{"63", " ", "f"}], "+", "g"}], ")"}]}], ",", RowBox[{ RowBox[{"-", "a"}], "-", "b", "-", "c", "-", "d", "-", "e", "-", "f", "+", RowBox[{"127", " ", "g"}]}]}], "}"}]], "Print", CellChangeTimes->{{3.598787471078409*^9, 3.598787478745409*^9}, { 3.5987887548729095`*^9, 3.598788779513809*^9}, 3.5988003629345093`*^9}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"NSolve", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Simplify", "[", RowBox[{"amounts", "[", RowBox[{"[", "ii", "]"}], "]"}], "]"}], "\[Equal]", "32"}], ",", RowBox[{"{", RowBox[{"ii", ",", "1", ",", "7"}], "}"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"a", ",", "b", ",", "c", ",", "d", ",", "e", ",", "f", ",", "g"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.5987885913110094`*^9, 3.598788693083309*^9}, { 3.598788723564109*^9, 3.598788728276109*^9}, {3.598789192781009*^9, 3.598789227837809*^9}, 3.598789263304509*^9, {3.5988003592056093`*^9, 3.598800366285509*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"a", "\[Rule]", "112.25`"}], ",", RowBox[{"b", "\[Rule]", "56.25`"}], ",", RowBox[{"c", "\[Rule]", "28.25`"}], ",", RowBox[{"d", "\[Rule]", "14.25`"}], ",", RowBox[{"e", "\[Rule]", "7.25`"}], ",", RowBox[{"f", "\[Rule]", "3.75`"}], ",", RowBox[{"g", "\[Rule]", "2.`"}]}], "}"}], "}"}]], "Output", CellChangeTimes->{3.5987892282788095`*^9, 3.5987892636825094`*^9, 3.598800367058509*^9}] }, Open ]] }, WindowSize->{843, 749}, WindowMargins->{{Automatic, -968}, {-3, Automatic}}, ShowSelection->True, FrontEndVersion->"6.0 for Microsoft Windows (64-bit) (April 20, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 2167, 55, 232, "Input"], Cell[CellGroupData[{ Cell[2782, 82, 484, 12, 23, "Print"], Cell[3269, 96, 645, 18, 23, "Print"], Cell[3917, 116, 795, 22, 23, "Print"], Cell[4715, 140, 951, 27, 43, "Print"], Cell[5669, 169, 1104, 32, 43, "Print"], Cell[6776, 203, 1255, 36, 43, "Print"], Cell[8034, 241, 1410, 41, 43, "Print"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[9493, 288, 719, 18, 52, "Input"], Cell[10215, 308, 488, 12, 30, "Output"] }, Open ]] } ] *) (* End of internal cache information *)