New Reply

Finding all combination of portions of a number.

 
Share Thread Thread Tools
Aug7-12, 10:29 PM   #1
 

Finding all combination of portions of a number.


Is there a way to define in how many ways can I form a number by it's portions?

e.g: the number 5 has 6 ways:
1+1+1+1+1
2+1+1+1
2+3
2+2+1
3+1+1
4+1
I was trying to program that and would appreciate any help!

Thanks.
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Bird's playlist could signal mental strengths and weaknesses
>> Minus environment, patterns still emerge: Computational study tracks E. coli cells' regulatory mechanisms
>> Bacterium uses natural 'thermometer' to trigger diarrheal disease, scientists find
Aug7-12, 11:21 PM   #2
 
http://ideone.com/WgG0w
Aug7-12, 11:29 PM   #3
 
This not-commented code is really hard to understand, could you explain the solution please?

Thanks
Aug8-12, 01:08 AM   #4
 
Recognitions:
Homework Helper Homework Help
Science Advisor Science Advisor

Finding all combination of portions of a number.


Also search web for 'partition numbers'
Aug8-12, 05:17 PM   #5
 
The basic idea is, think of your number as 1+1+1+... and think of all the different ways to put brackets in this expression.
New Reply

Tags
number, portions, programming
Thread Tools


Similar Threads for: Finding all combination of portions of a number.
Thread Forum Replies
Creating a number using a combination of two numbers General Math 5
Relating portions of Poiseille's Law to concepts of pressure/radius Introductory Physics Homework 4
finding a combination discrete and continuous cdf to make a new cdf Calculus & Beyond Homework 1
Finding non-trivial linear combination Calculus & Beyond Homework 5
Finding the total resistance-combination circuit Introductory Physics Homework 0