title: Why is my rubik's cube calculation off by 4000?
body: <p>I'm trying to throw together some quick and dirty javascript code to give me the number of possible piece permutations on a rubik's cube given a constraint such as &quot;1 edgepiece is solved&quot;. (sticking to 3x3 for simplicity) When I run the normal 12 edgepieces and 8 corners through my function, it's giving me a number that is 4000 greater than what I'm able to find should be the answer. (Function gives me 43,252,003,274,489,860,000 but <a href="https://www.youtube.com/watch?v=z2-d0x_qxSM" rel="nofollow noreferrer">https://www.youtube.com/watch?v=z2-d0x_qxSM</a> says it should be 43,252,003,274,489,856,000)</p>
  <p>My code:</p>
  <pre><code>// 3x3x3 Rubik's Cube
  edgepieces = 12;
  cornerpieces = 8;
  centerpieces = 6;
  
  // total possible permutations in general
  function numCombos(edges, corners) {
      result = ((factorial(edges) * (factorial(corners)) / 2) * (2 ** (edges - 1)) * (3 ** (corners - 1)));
      return result;
  }
  
  // n!
  function factorial(x) {
      if (x == 0) {
          return 1;
      } else {
          return x * factorial(x - 1);
      }   
  }
  
  console.log(numCombos(edgepieces, cornerpieces) + '\n');
  </code></pre>
  <p>I have followed a couple different arrangements for the core result algorithm, and they all give me this end result. What am I missing?</p>