title: algorithm to combinatorics
body: <p>I am trying to solve a combinatorics problem, it seems easy, but i am having some trouble with it.</p>
  
  <p>If i have at most X tables, and N persons to sit on the tables, Each table can have 1 to N seating places, and I can only sit persons in one side of a rectangular table( so the order how people sit matters). </p>
  
  <p>I want to make a code that can calculate all the distributions of seating places from 1 up to K tables. </p>
  
  <p>For example, if I have 12 persons and 1 table i have 479001600 ways of seating persons( thats easy to calculate I've used Factorial of 12).</p>
  
  <p>But if I have 12 persons and 3 tables i have 4390848000 ways of seating persons. I've tried different solutions but i was not able to find the correct one.</p>
  
  <p>I've tried to divided the 12 in 3, then o use factorial of the result (it didnt work), i've tried to use 12! * 3( it didn't work too).</p>
  
  <p>Can some one give me a tip in a algorithm that i can use?</p>