0
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ This would be more appropriate for math.stackexchange.com. $\endgroup$ Nov 17, 2011 at 8:19
  • $\begingroup$ Actually, it has been done to death at m.se, a little searching there should turn up the tools to solve the problem. $\endgroup$ Nov 17, 2011 at 11:24

1 Answer 1

0
$\begingroup$

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}$

$\endgroup$
3
  • $\begingroup$ 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$ $\endgroup$ Nov 17, 2011 at 8:35
  • $\begingroup$ Pietro indeed... $\endgroup$
    – joro
    Nov 17, 2011 at 8:39
  • $\begingroup$ 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$. $\endgroup$ Nov 17, 2011 at 13:56

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