I Ways of Getting Sum for n-ary Digits

  • I
  • Thread starter Thread starter rabbed
  • Start date Start date
  • Tags Tags
    Sum
rabbed
Messages
241
Reaction score
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
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.
 
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?
 
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!)}##
 
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
 
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 .
 
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
 
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.
 
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:
Back
Top