# How to find out the sum involving floor function [closed]

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.

-

## closed as off topic by Ryan Budney, Pietro Majer, Alain Valette, Loop Space, Gerry MyersonNov 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 math.stackexchange.com. –  Ryan Budney Nov 17 '11 at 8:19
Actually, it has been done to death at m.se, a little searching there should turn up the tools to solve the problem. –  Gerry Myerson Nov 17 '11 at 11:24

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)}
a(n)=Nearest integer to $\frac{n^2}{12}$
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
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