1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Factoring of addition?

  1. Mar 25, 2004 #1
    "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?
  2. jcsd
  3. Mar 26, 2004 #2

    matt grime

    User Avatar
    Science Advisor
    Homework Helper

    Look up partition functions.
  4. Apr 9, 2004 #3


    User Avatar

    try this

    Code (Text):

    #include <stdio.h>

    #define LOWEST 3

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

    void add (int pos, int a, int sum) {
        int i;
        if (sum>n) return;
        if (sum==n) {
            for (i=0;i<=pos;i++) fprintf(out, "%d ", c[i]);
            fprintf(out, "\n");
        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);
        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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Factoring of addition?
  1. Addition of Subspaces (Replies: 5)

  2. Addition of subspaces (Replies: 3)

  3. Additive Identity (Replies: 3)

  4. Co factor (Replies: 1)