Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Let P(n, k, m) be the number of possibilities to write n as a sum of k summands, with all summands being in the range [1, m]
  2.  
  3. If the order matters (so P(3,2,2) = 2, since 1+2 = 3 and 2+1 = 3)
  4.  
  5. P(n, 1, m) = 1 when m >= n
  6. P(n, 1, m) = 0 otherwise
  7. P(n, k, m) = sum from i=1 to m: P(n - i, k - 1, m)
  8.  
  9. If the order doesn't matter (so P(3,2,2) = 1, since 1+2 = 3)
  10.  
  11. P(n, 1, m) = 1 when m >= n
  12. P(n, 1, m) = 0 otherwise
  13. P(n, k, m) = sum from i=1 to m: P(n - i, k - 1, i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement