title: Counting the number of solutions for a given sudoku puzzle?
body: <p>I'm developing a web based sudoku game that allows the user to custom made his own sudoku board. I need a way of telling the user the number of possible solutions that the board he assembled has. The minimum number of entries for a sudoku to have a unique solution is 17. I need to find the number of solutions for number of entries less than 17.</p>
  
  <p>Here's my method:</p>
  
  <pre><code>public long numberOfSolutions (Board myBoard) {
      this.board = myBoard;
      this.tempBoard = new Board();
      long num = 0;
  
      tempBoard.copy(board);
      for (int i = 0; i &lt; 9; i++) {
          for (int j = 0; j &lt; 9; j++) {
              if (board.getCell(i,j).equals(0)) {
                  for(int k=1;k&lt;10;k++){
                      board.setCell(i, j, k, true);
                      if(isCorrect() &amp;&amp; solvable()){
                          num++;
                      }
                      board.copy(tempBoard);
                  }
              }
          }
      }
      return num;
  }
  </code></pre>
  
  <p>So basically for each empty cell I insert numbers from 1-9 and try to solve the game for each number. If successful increment the number of solutions. But this doesn't get me the number of all possible combinations, rather the sum of the number of numbers for each cell that can be plugged in.</p>
  
  <p>Is there a way I can calculate this ?</p>