Number of unequal integers with sum S

In summary: Nsets with s(i) < R for all i).In summary, the conversation discusses a problem of finding the number of unequal numbers that add up to a given sum S, with a fixed number of parts and a maximum number R. The R is important in the calculation and the problem is equivalent to a restricted unequal partitions problem. The goal is to find a technical solution that is less computationally intensive for large numbers.
  • #1
Jarfi
384
12
TL;DR Summary
Number of unequal numbers with sum S
Hello, I've been trying to solve this problem for a while, and I found a technical solution which is too computationally intensive for large numbers, I am trying to solve the problem using Combinatorics instead.

Given a set of integers 1, 2, 3, ..., 50 for example, where R=50 is the maximum, and a sample of n numbers from this set, what is the number of ways (number of sets) where sum(n) = S

Example:
R=50, n=4, S = 13

1+2+3+7 = 13
1+2+4+6 = 13
1+3+4+5 = 13
is the possible configurations for 13. But for say 16, we could have

1 + 3 + 4 + 8
1+3+5+7
1 + 2 + 5 + 8
1+ 2 + 6 + 7
etc ..

As you can see, the number of equivalent sums increases the higher S becomes.

Before I confuse you with what I tried does anybody have an idea on this ?

Note: partitions are not easily applicable here as we have a special case, where there needs to be x parts, all unequal, no 0s, etc.
 
Last edited:
Physics news on Phys.org
  • #2
Jarfi said:
Summary:: Number of unequal numbers with sum S

Before I confuse you with I tried does anybody have an idea on this ?
Yes.
 
  • #3
fresh_42 said:
Yes.
Ok, and?
 
  • #4
Jarfi said:
Example:
R=50, n=4, S = 13

1 + 2 + 3 + 7 = 13 is the only possible configuration here from my understanding. But for say 16, we could have
What's wrong with:

1 + 2 + 4 + 6 = 13
1 + 3 + 4 + 5 = 13
 
  • #5
PeroK said:
What's wrong with:

1 + 2 + 4 + 6 = 13
1 + 3 + 4 + 5 = 12
I am not interested in 12 if the goal is to find S = 13 . What is your point ?
 
  • #6
Jarfi said:
I am not interested in 12 if the goal is to find S = 13 . What is your point ?
That you can't count and I can't type?
 
  • Haha
Likes hutchphd
  • #7
PeroK said:
That you can't count and I can't type?
I can't count ?
 
  • #8
Jarfi said:
I can't count ?
1 + 3 + 4 + 5 = 13 (not 12)
 
  • #9
PeroK said:
1 + 3 + 4 + 5 = 13 (not 12)
See my updated post. There are several sums equivalent to 13, I wasn't being too accurate I concede
 
  • #10
Jarfi said:
See my updated post. There are several sums equivalent to 13, I wasn't being too accurate I concede
Why would your problem be significantly easier than partitions?
 
  • #11
PeroK said:
Why would your problem be significantly easier than partitions?
It is a problem of partitions, restricted unequal partitions into a fixed number of parts, that is. It is harder(computationally) to solve not easier. Thus the partitions approach may not be the most optimal.
 
  • #12
Does the R really matter to you? It's just going to cause weird complications on the split of whether S is larger or smaller than R.
 
  • #13
Office_Shredder said:
Does the R really matter to you? It's just going to cause weird complications on the split of whether S is larger or smaller than R.
The R matters yes, It is not the most complicated thing though the complication is that the samples should be unequal and restricted into a fixed number of parts.

S is the Sum
s is a sample from 1:50 or 1:R
n is the number of samples ( s(1), s(2), ..., s(n) where sum(s) = S )

Nr sets where s(i) < R for all i, are allowed. But we could also calculate this
Nsets with s(i) < R for all i =
Nsets ALL with any Natural Number s(i) -
Nsets with s(i) > R for at least one i


if it simplifies things.

Anyway if we can solve the problem without the size limit of R (Nsets ALL) the problem can be solved for the special case of s(i) < R
 

FAQ: Number of unequal integers with sum S

How do you calculate the number of unequal integers with a given sum?

To calculate the number of unequal integers with a given sum, you can use a mathematical formula known as the "stars and bars" method. This involves dividing the sum by the number of integers and then adding one to each quotient until the sum is reached. For example, if the sum is 10 and the number of integers is 3, you would divide 10 by 3 to get 3.33. Then, you would add one to each quotient (4, 3, 3) until you reach the sum of 10.

Can the number of unequal integers with a given sum be negative?

No, the number of unequal integers with a given sum cannot be negative. Integers are whole numbers, so they cannot be negative. If the sum is negative, it is not possible to have a positive number of unequal integers with that sum.

Is there a limit to the number of unequal integers that can have a given sum?

Yes, there is a limit to the number of unequal integers that can have a given sum. This limit is determined by the size of the sum and the number of integers. For example, if the sum is 10 and the number of integers is 3, the maximum number of unequal integers that can have a sum of 10 is 10.

Can the same set of unequal integers have different sums?

No, the same set of unequal integers cannot have different sums. Each set of integers has a unique sum, and changing one of the integers will result in a different sum. However, different sets of unequal integers can have the same sum.

How does the order of the integers affect the sum?

The order of the integers does not affect the sum. The sum is determined by the values of the integers, not their order. For example, the set of integers (2, 3, 5) will have the same sum as the set (5, 3, 2).

Back
Top