What Is the Term for Decomposing Numbers into Additive Combinations?

  • Context: High School 
  • Thread starter Thread starter jopux
  • Start date Start date
  • Tags Tags
    Addition Factoring
Click For Summary
SUMMARY

The discussion centers on the concept of decomposing numbers into additive combinations, commonly referred to as "partitioning." Participants explore the mathematical term for this process and inquire about computer programs that can generate these additive sets. The conversation highlights the use of a C program to compute partitions, specifically designed to find combinations of integers greater than 3 that sum to a specified number. The provided code demonstrates a recursive approach to generate these combinations, although it is noted to be slow and in need of optimization.

PREREQUISITES
  • Understanding of integer partitions in mathematics
  • Familiarity with recursive programming techniques
  • Basic knowledge of the C programming language
  • Concept of computational complexity and optimization strategies
NEXT STEPS
  • Research "integer partition theory" for deeper mathematical insights
  • Learn about "dynamic programming" to optimize partition algorithms
  • Explore existing libraries for "partition functions" in programming languages like Python or Java
  • Investigate performance profiling tools to analyze and improve code efficiency
USEFUL FOR

Mathematicians, computer scientists, and software developers interested in number theory, algorithm optimization, and recursive programming techniques.

jopux
Messages
1
Reaction score
0
"Factoring" of addition?

Is there a name for "factoring" addition? For example...let's say I'm working in a basis of all integers greater than 3. I can make 7 from 3+4; 8 from 4+4 or 3+5; 9 from 3+3+3 or 4+5 or 6+3...

Is there a name for this? And if so...are there computer programs that will generate these sets for me?
 
Physics news on Phys.org
Look up partition functions.
 
jopux said:
are there computer programs that will generate these sets for me?

try this

Code:
#include <stdio.h>

#define LOWEST 3

int n, c[1024];
FILE *out;

void add (int pos, int a, int sum) {
	int i;
	c[pos]=a;
	if (sum>n) return;
	if (sum==n) {
		for (i=0;i<=pos;i++) fprintf(out, "%d ", c[i]);
		fprintf(out, "\n");
		return;
	}
	for (i=a;i>=LOWEST;i--) add(pos+1, i, sum+i);
}

int main () {
	int i;
	printf("n: ");
	scanf("%d", &n);
	out=fopen("results.txt", "wt");
	for (i=n-LOWEST;i>=LOWEST;i--) add(0, i, i);
	fclose(out);
	return 0;
}

this is very slow, i'll try to think of a way to make it faster.

if source code is not allowed in the math forum, i am sorry, delete the post.
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
10K
  • · Replies 33 ·
2
Replies
33
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 48 ·
2
Replies
48
Views
6K
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K