Partition a Number n into k Parts: 7 Possible Solutions

  • Thread starter ziad1985
  • Start date
  • Tags
    Partition
In summary, the conversation discusses partitioning a number n into k parts, with an example of 9 into 3 parts. The participants discuss the use of combinations with repetition, but note that the number of possibilities is different when trying all of them. They also discuss the addition constraint and mention a generalised version of the problem. The conversation ends with a query about the language used in a given program.
  • #1
ziad1985
245
0
I want to partition a number n into k parts
for example 9 into 3 parts
x+y+z=9
and each element must be non zero , first look tells me it's combination with repetition.
however C(n-1,n-k) doesn't give the same number of possibilities when trying all of them.
x+y+z=9 C(8,6)=28
while trying them give only 7 possibilities
(7,1,1) (6,2,1) (5,2,2) (5,3,1) (4,4,1) (4,3,2) (3,3,3)
(1,7,1) is the same as (1,1,7) and (7,1,1) this small condition is changing the outcome , what kind of problem is this called ?
 
Physics news on Phys.org
  • #2
ziad1985 said:
I want to partition a number n into k parts
for example 9 into 3 parts
x+y+z=9
and each element must be non zero , first look tells me it's combination with repetition.

9 into 3 positive parts, is the same as 6 into 3 nonnegative parts, which is http://www.research.att.com/~njas/sequences/A038505 (6) = 28. I don't know a term for this better than "partitioning".
 
Last edited by a moderator:
  • #3
first thing , i didn't quiet understand what this is , plus i already stated that the number actually is 7 not 28.
any help with what I'm dealing with here?
 
  • #4
if you really "partitioning" that I believe that (1,1,7), (1,7,1) and (7,1,1) are identical in this context. nCr doesn't work because you have an addition constraint namely, x+y+z=constant. There is also a generalised version of this problem where you partition a number into[tex]N[/tex] parts (not just 3) where [tex]N\geq 1[/tex]. more interesting properties will ensure there too.
 
  • #5
where i can i find more info regarding this ?
 
  • #6
already find some stuff , but one question , in what language is this program written in?
INPUT m
DIM a(m),p(m)
FOR i = 0 TO m: p(i) = 1: NEXT i

FOR u = 2 TO m
FOR i = 0 TO m: a(i) = p(i): p(i) = 0: NEXT i
FOR j = 0 TO m STEP u
FOR k = j TO m
p(k) = p(k) + a(k-j)
NEXT k
NEXT j
NEXT u

REM
 
  • #7
I think it looks like qbasic
 

FAQ: Partition a Number n into k Parts: 7 Possible Solutions

What is "Partition a Number n into k Parts: 7 Possible Solutions"?

"Partition a Number n into k Parts: 7 Possible Solutions" is a mathematical problem that involves breaking a given number, n, into k smaller parts. In this specific problem, there are only 7 possible ways to partition the number n into k parts.

How do I partition a number into k parts?

To partition a number n into k parts, you can use a mathematical formula known as the "Partition function". This function takes in two inputs: the number n and the number of parts, k, and outputs all the possible ways to partition n into k parts.

What are some real-world applications of this problem?

Partitioning a number into k parts has various applications in fields such as computer science, economics, and physics. For example, it can be used in programming to optimize code and in economics to distribute resources efficiently. In physics, it can be used to understand the distribution of energy in a system.

Is there a specific strategy to solve this problem?

Yes, there is a specific algorithm known as the "Recursive Partitioning Algorithm" that can be used to solve this problem. This algorithm breaks down the problem into smaller subproblems until it reaches a base case, and then combines the solutions to the subproblems to get the final solution.

Can this problem be solved for any value of n and k?

Yes, this problem can be solved for any positive integer values of n and k. However, as the values of n and k increase, the number of possible solutions also increases, making it more complex to solve.

Similar threads

Replies
4
Views
4K
Replies
18
Views
2K
2
Replies
61
Views
9K
Replies
1
Views
2K
2
Replies
61
Views
7K
3
Replies
100
Views
9K
Replies
7
Views
3K
Back
Top