(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[      2829,         92]
NotebookOptionsPosition[      2585,         79]
NotebookOutlinePosition[      2930,         94]
CellTagsIndexPosition[      2887,         91]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"n", "=", "10"}], ";"}], 
  RowBox[{"(*", 
   RowBox[{"20", ",", "50", ",", "100"}], "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"Postupnost1", "=", 
   RowBox[{"Table", "[", 
    RowBox[{
     RowBox[{"NestWhile", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Join", "[", 
         RowBox[{"#", ",", 
          RowBox[{"{", 
           RowBox[{"Generovane", "=", 
            RowBox[{"RandomVariate", "[", 
             RowBox[{"BinomialDistribution", "[", 
              RowBox[{"1", ",", "0.5"}], "]"}], "]"}]}], "}"}]}], "]"}], 
        "&"}], ",", 
       RowBox[{"{", "5", "}"}], ",", 
       RowBox[{
        RowBox[{
         RowBox[{"Last", "[", "#", "]"}], ">", "0"}], "&"}]}], "]"}], ",", 
     RowBox[{"{", 
      RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"Postupnost2", "=", 
   RowBox[{"Drop", "[", 
    RowBox[{"Postupnost1", ",", "None", ",", "1"}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{"Dlzky", "=", 
  RowBox[{"Map", "[", 
   RowBox[{"Length", ",", "Postupnost2"}], "]"}]}], "\[IndentingNewLine]", 
 RowBox[{"Najdlhsia", "=", 
  RowBox[{"Max", "[", "Dlzky", "]"}]}], "\[IndentingNewLine]", 
 RowBox[{"PoctyDlzok", "=", 
  RowBox[{"BinCounts", "[", 
   RowBox[{"Dlzky", ",", 
    RowBox[{"{", 
     RowBox[{"1", ",", 
      RowBox[{"Najdlhsia", "+", "1"}], ",", "1"}], "}"}]}], 
   "]"}]}], "\[IndentingNewLine]", 
 RowBox[{"Vyhry1", "=", 
  RowBox[{"NestList", "[", 
   RowBox[{
    RowBox[{
     RowBox[{"#", "*", "2"}], "&"}], ",", "2", ",", 
    RowBox[{"Najdlhsia", "-", "1"}]}], "]"}]}], "\[IndentingNewLine]", 
 RowBox[{"VyhrySucet1", "=", 
  RowBox[{"PoctyDlzok", ".", "Vyhry1"}]}], "\[IndentingNewLine]", 
 RowBox[{"PoplatokJednotlivo", "=", 
  RowBox[{"n", "*", "24"}]}], "\[IndentingNewLine]", 
 RowBox[{"Zisk", "=", 
  RowBox[{"VyhrySucet1", "-", "PoplatokJednotlivo"}]}]}], "Input",
 CellChangeTimes->{{3.54691456267153*^9, 3.5469149616179185`*^9}}]
},
WindowSize->{707, 761},
WindowMargins->{{24, Automatic}, {Automatic, 30}},
FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (February 23, 2011)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[557, 20, 2024, 57, 272, "Input"]
}
]
*)

(* End of internal cache information *)

