Finding all combination of portions of a number.

  • Context: Undergrad 
  • Thread starter Thread starter lucasfeijo
  • Start date Start date
  • Tags Tags
    Combination
Click For Summary

Discussion Overview

The discussion revolves around the problem of determining the number of ways to form a number by its portions, specifically focusing on the concept of partitioning a number. Participants explore various approaches and seek clarification on programming solutions related to this topic.

Discussion Character

  • Exploratory, Technical explanation, Homework-related

Main Points Raised

  • One participant asks how to define the number of ways to form a number by its portions, providing the example of the number 5 and listing its partitions.
  • Another participant shares a link to code that presumably addresses the problem but does not provide context or explanation.
  • A participant requests clarification on the shared code, indicating that it is difficult to understand without comments.
  • One participant suggests searching the web for 'partition numbers' as a potential resource for further information.
  • Another participant proposes a conceptual approach, suggesting that one can think of the number as a sum of ones and consider the different ways to arrange brackets in this expression.

Areas of Agreement / Disagreement

There is no consensus on a specific method or solution, and multiple perspectives on how to approach the problem are presented.

Contextual Notes

The discussion includes references to programming solutions and mathematical concepts without resolving the underlying complexities or assumptions related to partitioning numbers.

lucasfeijo
Messages
2
Reaction score
0
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.
 
Physics news on Phys.org
This not-commented code is really hard to understand, could you explain the solution please?

Thanks
 
Also search web for 'partition numbers'
 
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.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 26 ·
Replies
26
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K