Guest User

Untitled

a guest
Sep 30th, 2014
260
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (* Content-type: application/vnd.wolfram.cdf.text *)
  2.  
  3. (*** Wolfram CDF File ***)
  4. (* http://www.wolfram.com/cdf *)
  5.  
  6. (* CreatedBy='Mathematica 10.0' *)
  7.  
  8. (*************************************************************************)
  9. (* *)
  10. (* The Mathematica License under which this file was created prohibits *)
  11. (* restricting third parties in receipt of this file from republishing *)
  12. (* or redistributing it by any means, including but not limited to *)
  13. (* rights management or terms of use, without the express consent of *)
  14. (* Wolfram Research, Inc. For additional information concerning CDF *)
  15. (* licensing and redistribution see: *)
  16. (* *)
  17. (* www.wolfram.com/cdf/adopting-cdf/licensing-options.html *)
  18. (* *)
  19. (*************************************************************************)
  20.  
  21. (*CacheID: 234*)
  22. (* Internal cache information:
  23. NotebookFileLineBreakTest
  24. NotebookFileLineBreakTest
  25. NotebookDataPosition[ 1064, 20]
  26. NotebookDataLength[ 4382, 141]
  27. NotebookOptionsPosition[ 5046, 141]
  28. NotebookOutlinePosition[ 5388, 156]
  29. CellTagsIndexPosition[ 5345, 153]
  30. WindowFrame->Normal*)
  31.  
  32. (* Beginning of Notebook Content *)
  33. Notebook[{
  34. Cell[BoxData[{
  35. RowBox[{
  36. RowBox[{"SeedRandom", "@",
  37. RowBox[{"Input", "[", "]"}]}], ";"}], "\[IndentingNewLine]",
  38. RowBox[{
  39. RowBox[{"g", "=",
  40. RowBox[{
  41. RowBox[{"0", "&"}], "~", "Array", "~",
  42. RowBox[{"{",
  43. RowBox[{"109", ",", "109"}], "}"}]}]}], ";"}], "\[IndentingNewLine]",
  44. RowBox[{
  45. RowBox[{
  46. RowBox[{"g", "[",
  47. RowBox[{"[",
  48. RowBox[{"2", ",", "2"}], "]"}], "]"}], "=", "1"}],
  49. ";"}], "\[IndentingNewLine]",
  50. RowBox[{
  51. RowBox[{"h", "=",
  52. RowBox[{"{",
  53. RowBox[{"{",
  54. RowBox[{"2", ",", "2"}], "}"}], "}"}]}], ";"}], "\[IndentingNewLine]",
  55. RowBox[{
  56. RowBox[{"For", "[",
  57. RowBox[{
  58. RowBox[{"n", "=", "1"}], ",",
  59. RowBox[{"n", "<", "1009"}], ",", "\[IndentingNewLine]",
  60. RowBox[{
  61. RowBox[{"c", "=",
  62. RowBox[{"RandomChoice", "@", "h"}]}], ";", "\[IndentingNewLine]",
  63. RowBox[{"d", "=",
  64. RowBox[{"RandomChoice", "[",
  65. RowBox[{"m", "=",
  66. RowBox[{"{",
  67. RowBox[{
  68. RowBox[{"{",
  69. RowBox[{"1", ",", "0"}], "}"}], ",",
  70. RowBox[{"{",
  71. RowBox[{"0", ",", "1"}], "}"}]}], "}"}]}], "]"}]}], ";",
  72. "\[IndentingNewLine]",
  73. RowBox[{"If", "[",
  74. RowBox[{
  75. RowBox[{
  76. RowBox[{"FreeQ", "[",
  77. RowBox[{
  78. RowBox[{"e", "=",
  79. RowBox[{"c", "+", "d"}]}], ",",
  80. RowBox[{"1", "|", "109"}]}], "]"}], "&&",
  81. RowBox[{
  82. RowBox[{"Count", "[",
  83. RowBox[{
  84. RowBox[{"g", "[",
  85. RowBox[{"[",
  86. RowBox[{
  87. RowBox[{"2", ";;",
  88. RowBox[{"e", "[",
  89. RowBox[{"[", "1", "]"}], "]"}]}], ",",
  90. RowBox[{"2", ";;",
  91. RowBox[{"e", "[",
  92. RowBox[{"[", "2", "]"}], "]"}]}]}], "]"}], "]"}], ",", "0",
  93. ",", "2"}], "]"}], "\[Equal]", "1"}]}], ",", "\[IndentingNewLine]",
  94. RowBox[{
  95. RowBox[{"++", "n"}], ";", "\[IndentingNewLine]",
  96. RowBox[{"h", "~", "AppendTo", "~", "e"}], ";", "\[IndentingNewLine]",
  97. RowBox[{
  98. RowBox[{"g", "[",
  99. RowBox[{"[",
  100. RowBox[{
  101. RowBox[{"##", "&"}], "@@", "e"}], "]"}], "]"}], "=", "1"}]}]}],
  102. "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}],
  103. ";"}], "\[IndentingNewLine]",
  104. RowBox[{
  105. RowBox[{
  106. RowBox[{
  107. RowBox[{"(", "\[IndentingNewLine]",
  108. RowBox[{
  109. RowBox[{"c", "=", "#"}], ";", "\[IndentingNewLine]",
  110. RowBox[{
  111. RowBox[{
  112. RowBox[{"If", "[",
  113. RowBox[{
  114. RowBox[{
  115. RowBox[{"e", "=",
  116. RowBox[{"c", "+", "#"}]}], ";",
  117. RowBox[{
  118. RowBox[{"g", "[",
  119. RowBox[{"[",
  120. RowBox[{
  121. RowBox[{"##", "&"}], "@@", "e"}], "]"}], "]"}], "<", "1"}]}],
  122. ",", "\[IndentingNewLine]",
  123. RowBox[{
  124. RowBox[{"g", "[",
  125. RowBox[{"[",
  126. RowBox[{
  127. RowBox[{"##", "&"}], "@@", "e"}], "]"}], "]"}], "=", "2"}]}],
  128. "\[IndentingNewLine]", "]"}], "&"}], "/@",
  129. RowBox[{"Join", "@@",
  130. RowBox[{"{",
  131. RowBox[{"m", ",",
  132. RowBox[{"-", "m"}]}], "}"}]}]}]}], ")"}], "&"}], "/@", "h"}],
  133. ";"}], "\[IndentingNewLine]",
  134. RowBox[{"ArrayPlot", "[",
  135. RowBox[{"g", ",",
  136. RowBox[{"ImageSize", "\[Rule]", "409"}], ",",
  137. RowBox[{"PixelConstrained", "\[Rule]", "True"}], ",",
  138. RowBox[{"Frame", "\[Rule]",
  139. RowBox[{"0", ">", "1"}]}]}], "]"}]}], "Input",
  140. CellChangeTimes->{{3.621080815817226*^9, 3.6210808199436903`*^9}}]
  141. },
  142. WindowSize->{789, 872},
  143. WindowMargins->{{323, Automatic}, {23, Automatic}},
  144. FrontEndVersion->"10.0 for Microsoft Windows (64-bit) (July 1, 2014)",
  145. StyleDefinitions->"Default.nb"
  146. ]
  147. (* End of Notebook Content *)
  148.  
  149. (* Internal cache information *)
  150. (*CellTagsOutline
  151. CellTagsIndex->{}
  152. *)
  153. (*CellTagsIndex
  154. CellTagsIndex->{}
  155. *)
  156. (*NotebookFileOutline
  157. Notebook[{
  158. Cell[1464, 33, 3578, 106, 392, "Input"]
  159. }
  160. ]
  161. *)
  162.  
  163. (* End of internal cache information *)
  164.  
  165. (* NotebookSignature 8upZ4aM3#Iq@XAKWpeDJ2TFl *)
RAW Paste Data