Ways of Getting Sum for n-ary Digits

  • I
  • Thread starter rabbed
  • Start date
  • Tags
    Sum
In summary, there are a variety of different formulas that can be used to calculate the number of ways to get a certain sum with a given number of binary or n-ary digits. However, the formula for n-ary digits may be more complex and dissimilar to the one for binary digits due to the increased number of possibilities. Additionally, the distribution of ways may change when the number of digits increases, potentially resulting in a normal distribution. There is also the possibility of using permutations and combinations to calculate the number of ways, as demonstrated in the example of three trinary digits.
  • #1
rabbed
243
3
For d binary digits, the number of ways W to get sum s is:
W(d,s) = d! / (s! * (d-s)!)

Are there similar formula(s) for n-ary digits?
 
Last edited:
Physics news on Phys.org
  • #2
It would be vastly more complex because there is only one way to get s with binaries when we disregard digit order, but there are many different unordered ways to get s with say digits in 0..9. So first we'd need to count the unordered ways. Then we'd have to use a hypergeometric or some such distribution to count the number of different ways to order those combinations.

I expect the resulting formula would be (a) long and (b) very dissimilar to the one for binaries.
 
  • #3
I think I found it:
https://www.lucamoroni.it/the-dice-roll-sum-problem/

My interest is in entropy and I guess my real question was how the distribution of ways change when "n" in my case goes to infinity (particle energies may have more than 2 values).
But if I understand correctly, the large number of d (particles/dice/digits) gives the distribution the form of a normal distribution and the number of digit values n only increases the height of the distribution of ways, so that it can then be normalized into a probability distribution by dividing by n^d in the terminology I used.

Does it make sense?
 
  • #4
This seems, if I understood correctly, the balls-in-boxes problems, or flgas-staffs problem with number of solutions to ##x_1+...+x_k =n ## given by
##(n+k-1)C(k-1):= \frac {(n+k-1)!}{(k-1)!(n!)}##
 
  • #5
I'm not getting correct values for the case of three trinary values [0,1,2], which should be:

sum = 0 -> W = 1
sum = 1 -> W = 3
sum = 2 -> W = 6
sum = 3 -> W = 7
sum = 4 -> W = 6
sum = 5 -> W = 3
sum = 6 -> W = 1
 
  • #6
rabbed said:
I'm not getting correct values for the case of three trinary values [0,1,2], which should be:

sum = 0 -> W = 1
sum = 1 -> W = 3
sum = 2 -> W = 6
sum = 3 -> W = 7
sum = 4 -> W = 6
sum = 5 -> W = 3
sum = 6 -> W = 1
Sorry, this is for the decimal case. It is the number of ways of filling k boxes with n objects, all in decimal .
 
  • #7
Is it possible to reason about this using permutations and combinations somehow to get a formula?
When doing this manually, at each pick of a die I guess you're using the number of dice you have left to pick vs. how many dice of min/max value is needed to reach the sum.

----- choosing three trinary dice and get sum 0:

with the first die we have 1 possibility:
__0: with the second die we have 1 possibility:
____0: with the third die we have 1 possibility:
______0: this is one way to get sum 0

number of ways = 1

----- choosing three trinary dice and get sum 1:

with the first die we have 2 possibilities:
__0: with the second die we have 2 possibilities:
____0: with the third die we have 1 possibility:
______1: this is one way to get sum 1
____1: with the third die we have 1 possibility:
______0: this is one way to get sum 1
__1: with the second die we have 1 possibility:
____0: with the third die we have 1 possibility:
______0: this is one way to get sum 1

number of ways = 3

----- choosing three trinary dice and get sum 2:

with the first die we have 3 possibilities:
__0: with the second die we have 3 possibilities:
____0: with the third die we have 1 possibility:
______2: this is one way to get sum 2
____1: with the third die we have 1 possibility:
______1: this is one way to get sum 2
____2: with the third die we have 1 possibility:
______0: this is one way to get sum 2
__1: with the second die we have 2 possibilities:
____0: with the third die we have 1 possibility:
______1: this is one way to get sum 2
____1: with the third die we have 1 possibility:
______0: this is one way to get sum 2
__2: with the second die we have 1 possibility:
____0: with the third die we have 1 possibility:
______0: this is one way to get sum 2

number of ways = 6

----- choosing three trinary dice and get sum 3:

with the first die we have 3 possibilities:
__0: with the second die we have 2 possibilities:
____1: with the third die we have 1 possibility:
______2: this is one way to get sum 3
____2: with the third die we have 1 possibility:
______1: this is one way to get sum 3
__1: with the second die we have 3 possibilities:
____0: with the third die we have 1 possibility:
______2: this is one way to get sum 3
____1: with the third die we have 1 possibility:
______1: this is one way to get sum 3
____2: with the third die we have 1 possibility:
______0: this is one way to get sum 3
__2: with the second die we have 2 possibilities:
____0: with the third die we have 1 possibility:
______1: this is one way to get sum 3
____1: with the third die we have 1 possibility:
______0: this is one way to get sum 3

number of ways = 7

----- choosing three trinary dice and get sum 4:

with the first die we have 3 possibilities:
__0: with the second die we have 1 possibility:
____2: with the third die we have 1 possibility:
______2: this is one way to get sum 4
__1: with the second die we have 2 possibilities:
____1: with the third die we have 1 possibility:
______2: this is one way to get sum 4
____2: with the third die we have 1 possibility:
______1: this is one way to get sum 4
__2: with the second die we have 3 possibilities:
____0: with the third die we have 1 possibility:
______2: this is one way to get sum 4
____1: with the third die we have 1 possibility:
______1: this is one way to get sum 4
____2: with the third die we have 1 possibility:
______0: this is one way to get sum 4

number of ways = 6

----- choosing three trinary dice and get sum 5:

with the first die we have 2 possibilities:
__1: with the second die we have 1 possibility:
____2: with the third die we have 1 possibility:
______2: this is one way to get sum 5
__2: with the second die we have 2 possibilities:
____1: with the third die we have 1 possibility:
______2: this is one way to get sum 5
____2: with the third die we have 1 possibility:
______1: this is one way to get sum 5

number of ways = 3

----- choosing three trinary dice and get sum 6:

with the first die we have 1 possibility:
__2: with the second die we have 1 possibility:
____2: with the third die we have 1 possibility:
______2: this is one way to get sum 5

number of ways = 1
 
  • #8
I'm sure it's related to the number of partitions of an integer.
http://mathworld.wolfram.com/PartitionFunctionP.html

But that counts the number of ways to sum up to ##n## with positive numbers. There are more cases here because you're adding in zeros as well.

Perhaps if you look at the derivations of the partition function there's something that can be generalized to this problem.
 
  • #9
Found this discussion:
https://math.stackexchange.com/ques...of-ways-n-m-sided-dice-can-add-up-t/4652#4652
That answer gives the solution where each die has minimum value 1 and maximum value M.
At the bottom there is an answer where each die has minimum value 0 and maximum value M.
Can you help me get the answer with a variable minimum die value, L?

Is it correct to think that these formulas give the number of ways to distiguishably arrange dice values to produce a certain sum, whereas multinomial coefficients has to do with the number of ways to indistinguishably arrange dice values to produce a certain sum?
 
Last edited:

Related to Ways of Getting Sum for n-ary Digits

What is the concept of "Ways of Getting Sum for n-ary Digits"?

The concept of "Ways of Getting Sum for n-ary Digits" refers to the various methods or techniques that can be used to calculate the sum of n-ary digits, where n represents any positive integer.

Why is it important to understand the ways of getting sum for n-ary digits?

Understanding the ways of getting sum for n-ary digits is important because it allows us to efficiently calculate the sum of large numbers and perform various mathematical operations on them. This knowledge is especially useful in fields such as computer science, cryptography, and data analysis.

What are some common examples of n-ary digits?

Some common examples of n-ary digits include binary digits (0 and 1), decimal digits (0-9), hexadecimal digits (0-9 and A-F), and octal digits (0-7).

What are the different methods of getting sum for n-ary digits?

There are several methods of getting sum for n-ary digits, including the column method, the carry method, and the digit-by-digit method. Each method has its own advantages and is suitable for different types of calculations.

Can the ways of getting sum for n-ary digits be applied to numbers with different bases?

Yes, the ways of getting sum for n-ary digits can be applied to numbers with different bases. However, the specific method used may vary depending on the base of the numbers. For example, the column method may be more suitable for numbers with a base of 10, while the carry method may be more efficient for numbers with a base of 2.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
11
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
12
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
20
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
905
Replies
7
Views
977
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
14
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
2K
Back
Top