# Tiny maths question.

This topic is 2777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Okay so user has 10 points that he / she is allowed to distribute between three factors: a, b and c. As such, the user may choose to put 10 in a but none in b or c (or any other combination). I need an efficient sum of some sort, that will differentiate all possible combinations, due to the sum resulting in different values.

##### Share on other sites
Sorry, I'm not clear on what you actually want - you want to know how many possible combinations of point allocations there are?

##### Share on other sites
This sounds suspiciously like a school assignment...

Here's one way to look at it. Given the contraint that a+b+c=N, you only have two degrees of freedom. Once you choose a, you have N-a options for b. At that point, c has only one option: N-a-b. So:

a=N: b=0 c=0
a=N-1: b=0 c=1, b=1 c=0
a=N-2: b=0 c=2, b=1 c=1, b=2 c=0
a=N-3: b=0 c=3, b=1 c=2, b=2 c=1, b=3 c=0
...
a=0: b=0 c=N, b=1 c=N-1, b=2 c=N-2, b=3 c=N-3, ..., b=N c=0

If you visualize the pattern on an N×N square, the valid combinations form a triangle including the diagonal. That gives N×(N+1)/2 combinations. (If it excluded the diagonal, it would be N×(N-1)/2 instead.)

 * . . . . . . . . . * * . . . . . . . . * * * . . . . . . . * * * * . . . . . . * * * * * . . . . . * * * * * * . . . . * * * * * * * . . . * * * * * * * * . . * * * * * * * * * . * * * * * * * * * * 

##### Share on other sites

Okay so user has 10 points that he / she is allowed to distribute between three factors: a, b and c. As such, the user may choose to put 10 in a but none in b or c (or any other combination). I need an efficient sum of some sort, that will differentiate all possible combinations, due to the sum resulting in different values.

Why not just use 11a + b?

1. 1
2. 2
Rutin
20
3. 3
khawk
16
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633756
• Total Posts
3013709
×