MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I came up with an equation while solving a question. The question is - suppose we have n numbers, from 1 up to n. How many groups of 3 numbers (repetition allowed) can be formed whose sum will be n.

The equation I came up with is something like this:

$\sum_{i=1}^{\left \lfloor \frac{n}{3} \right \rfloor} \left \lfloor \frac{n-i}{2} \right \rfloor-i+1$

This is giving correct result I hope. For example, for n=7, we can form 4 groups, (1,1,5), (1,2,4), (1,3,3), (2,2,3). My question is, how to get a more compact form of this equation? I am stuck since I don't find a way of finding the sum involving floor function.

share|cite|improve this question

closed as off topic by Ryan Budney, Pietro Majer, Alain Valette, Loop Space, Gerry Myerson Nov 17 '11 at 11:22

Questions on MathOverflow are expected to relate to research level mathematics within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This would be more appropriate for – Ryan Budney Nov 17 '11 at 8:19
Actually, it has been done to death at, a little searching there should turn up the tools to solve the problem. – Gerry Myerson Nov 17 '11 at 11:24
up vote 0 down vote accepted

Your sum is related to OEIS A001399 Number of partitions of n into at most 3 parts which is close to your formula a(n)=sum{k=0..floor(n/3), floor((n-3k+2)/2)}

This leads to Number of partitions of n into 3 positive parts

a(n)=Nearest integer to $\frac{n^2}{12}$

share|cite|improve this answer
actually the OP wants exactly 3 parts, so the OEIS' sequence has to be shifted by 3, and the answer should be the closest integer to $n^2/12$ – Pietro Majer Nov 17 '11 at 8:35
Pietro indeed... – joro Nov 17 '11 at 8:39
Also note that since the gf of $a(n)$ is $\frac{x^3}{(1−x)(1−x^2)(1−x^3)}$, with poles at sixth roots of unity, which are all simple but $x\neq 1$, $a(n)−n^2/12$ has periodicity $6$. – Pietro Majer Nov 17 '11 at 13:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.