<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml">
  <head>
    <title>Farkle formulas using MathML</title>
  </head>
  <body>
    <h1>Farkle formulas using MathML</h1>
    <p><a href="http://www.smartboxdesign.com/farklerules.html">Rules of Farkle</a></p>
    <div xmlns:m="http://www.w3.org/1998/Math/MathML">
    <dl>
    <dt>Probability of Farkling with six dice:</dt>
    <dd>
      To Farkle with six dice, you have to not roll any 1's or 5's.  (for this
      problem, let's choose the dice in order)  So, you have to choose
      6 dice from the set
      <m:math>
        <m:set><m:cn>2</m:cn><m:cn>3</m:cn><m:cn>4</m:cn><m:cn>6</m:cn></m:set>
      </m:math>.
      However, you can't get more than three of any of these elements,
      and you can't get three pairs either.  So this leaves us with choosing
      2, 2, 1, 1 of the set 
      <m:math>
        <m:set><m:cn>2</m:cn><m:cn>3</m:cn><m:cn>4</m:cn><m:cn>6</m:cn></m:set>
      </m:math>.
      The number of ways to do this is just the number of ways of
      first choosing which numbers to choose two of (
      <m:math>
        <m:row>
          <m:apply>
            <m:eq/>
            <m:semantics>
              <m:apply>
                <m:csymbol definitionURL="http://www.openmath.org/cd/combinat1.ocd"/>
                <m:cn>4</m:cn>
                <m:cn>2</m:cn>
              </m:apply>
              <m:annotation-xml encoding="MathML-Presentation">
                <m:mfenced><m:mtable><m:mtr><m:mtd><m:mn>4</m:mn></m:mtd></m:mtr><m:mtr><m:mtd><m:mn>2</m:mn></m:mtd></m:mtr></m:mtable></m:mfenced>
              </m:annotation-xml>
            </m:semantics>
            <m:cn>6</m:cn>
          </m:apply>
        </m:row>
      </m:math>)
      and then ordering these (
      <m:math>
        <m:row>
          <m:semantics>
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:divide/>
              <m:apply>
                <m:factorial/>
                <m:cn>6</m:cn>
              </m:apply>
              <m:apply>
                <m:times/>
                <m:apply>
                  <m:factorial/>
                  <m:cn>2</m:cn>
                </m:apply>
                <m:apply>
                  <m:factorial/>
                  <m:cn>2</m:cn>
                </m:apply>
              </m:apply>
            </m:apply>
            <m:cn>180</m:cn>
          </m:apply>
          <m:annotation-xml encoding="MathML-Presentation">
            <m:mfrac>
              <m:mrow>
                <m:mrow>
                  <m:mn>6</m:mn>
                  <m:mo>!</m:mo>
                </m:mrow>
              </m:mrow>
              <m:mrow>
                <m:mrow>
                  <m:mn>2</m:mn>
                  <m:mo>!</m:mo>
                  <m:mn>2</m:mn>
                  <m:mo>!</m:mo>
                </m:mrow>
              </m:mrow>
            </m:mfrac>
          </m:annotation-xml>
          </m:semantics>
        </m:row>
      </m:math>)
      So, the total number of ways to do this is
      <m:math>
        <m:row>
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:times/>
              <m:cn>6</m:cn>
              <m:cn>180</m:cn>
            </m:apply>
            <m:cn>1080</m:cn>
          </m:apply>
        </m:row>
      </m:math>,
      and the total number of ways to roll 6 dice is
      <m:math>
        <m:row>
          <m:apply>
            <m:eq/>
            <m:apply>
              <m:power/>
              <m:cn>6</m:cn>
              <m:cn>6</m:cn>
            </m:apply>
            <m:cn>46656</m:cn>
          </m:apply>
        </m:row>
      </m:math>,
      so the total probability is
      <m:math>
        <m:row>
          <m:apply>
            <m:eq/>
            <m:semantics>
              <m:apply>
                <m:divide/>
                <m:cn>1080</m:cn>
                <m:cn>46656</m:cn>
              </m:apply>
              <m:annotation-xml encoding="MathML-Presentation">
                <m:mfrac>
                  <m:mrow>
                    <m:mrow>
                      <m:cn>1080</m:cn>
                    </m:mrow>
                  </m:mrow>
                  <m:mrow>
                    <m:mrow>
                      <m:cn>46656</m:cn>
                    </m:mrow>
                  </m:mrow>
                </m:mfrac>
              </m:annotation-xml>
            </m:semantics>
            <m:cn>.0231481</m:cn>
          </m:apply>
        </m:row>
      </m:math>,
      or about 2 percent.
    </dd>
    </dl>
    </div>
    <p>
    Wow, it says in <a href="http://www.w3.org/TR/2003/REC-MathML2-20031021/chapter1.html#id.1.3.1">the MathML spec</a> that
    <blockquote>
      As a consequence, raw MathML markup is not  primarily intended for direct use by authors. While MathML is human-readable, which helps a lot in debugging it, in all but the simplest cases it is too verbose and error-prone for hand generation. 
    </blockquote>
    and they're right.  Coding this stuff up by hand is a pretty big pain.
    </p>
    <p><a href="http://www.gregstoll.com">Greg's home page</a></p>
<!--#include virtual="/endOfBody.html"-->
  </body>
</html>
