Thread: Problem 36
View Single Post
  #2  
Old September 5th, 2007, 05:39 AM
janvdl's Avatar
janvdl janvdl is offline
Bar0n

 
Join Date: Apr 2007
Location: South African Republic
Posts: 1,959
Country:
Thanks: 1,605
Thanked 1,421 Times in 869 Posts
janvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant futurejanvdl has a brilliant future
Send a message via MSN to janvdl
Default

Quote:
Originally Posted by ThePerfectHacker View Post
2. Given a positive integer n define a k-partition to be a sum of k positive integers which sum to n. For example, n=10. The following are 4-partitions. 10 = 4+4+2+2 and 10 = 2+2+4+4 and 10 = 1+1+1+7. Notice that 2+2+4+4\mbox{ and }4+4+2+2 are considered distinct*. Say you a given a specific n. And given a specific value of k, can you find the total number of k-partitions of this integer, with a formula?** Now try to see how many partitions (again not counting order) exist for a given integer n (the answer is really supprising).

Hint: Review your Combinatorics formula for this one.
\frac{(n + k - 1)!}{k!(n - 1)!}

So if n = 10 and using 4-partitions(including repetitions), then we will have 715 possibilities.

\frac{(10 + 4 - 1)!}{4!((10 - 1)!)} = 715


Am i even close to correct?
__________________
If you need more than 3 levels of indentation, you're screwed anyway, and should fix your program. - Linus Torvalds


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.