All possible sums

So my questions is, how many possible groups of 3 numbers, can have a sum equal to a number, lets say N.

Can you explain some sort of algorithm, I don't need code.


Thanks.
Last edited on
How many possible groups of 3 numbers can have a sum equal to a number?


There are an infinite number of groups that would sum to a certain number if you do not provide any restrictions.
Oh wait, I forgot.

The numbers must be equal or more than 1, and not decimal.
Can there be repeated numbers? Eg. a=1, b=1, c=1?
Are these considers the same or different?
a=1, b=1, c=2
a=1, b=2, c=1
a=2, b=1, c=1
No, sequence doesn't matter. a=1, b=1, c=2 would be the same with a=2, b=1, c=1.
But, it is allowed that a=b or a=c or b=c or a=b=c.
Last edited on
Topic archived. No new replies allowed.