Ways of Getting Sum for n-ary Digits

  • Context: Undergrad 
  • Thread starter Thread starter rabbed
  • Start date Start date
  • Tags Tags
    Sum
Click For Summary

Discussion Overview

The discussion revolves around finding formulas for the number of ways to achieve a specific sum using n-ary digits, particularly focusing on binary and trinary cases. Participants explore theoretical frameworks, mathematical models, and combinatorial reasoning related to this problem.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant presents a formula for binary digits to calculate the number of ways to achieve a sum, questioning if similar formulas exist for n-ary digits.
  • Another participant suggests that the complexity increases with n-ary digits due to the multiple unordered combinations possible, proposing the use of hypergeometric distribution for counting arrangements.
  • A participant references an external source related to the distribution of ways to achieve sums with n-ary digits and discusses the implications for entropy and normal distribution as n increases.
  • One participant relates the problem to the "balls-in-boxes" problem, providing a combinatorial formula for counting solutions to a sum equation.
  • Several participants express difficulties in calculating the correct number of ways for specific sums using trinary values, sharing their expected outcomes for verification.
  • Another participant inquires about using permutations and combinations to derive a formula, illustrating the reasoning process for calculating the number of ways to achieve specific sums with trinary dice.
  • A participant suggests that the problem may relate to the number of partitions of an integer, noting the inclusion of zeros complicates the standard partition function.
  • One participant shares a link to a discussion on counting the number of ways n-sided dice can sum to a certain value, asking for clarification on variable minimum die values and the distinction between distinguishable and indistinguishable arrangements.

Areas of Agreement / Disagreement

Participants express various viewpoints and approaches to the problem, with no consensus reached on a single formula or method. Disagreements arise regarding the correct calculations for specific cases and the applicability of different mathematical concepts.

Contextual Notes

Some participants note limitations in their calculations and assumptions, particularly regarding the treatment of zeros in sums and the complexity introduced by varying the minimum die values.

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:

Similar threads

  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
992
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K