# How many solutions are possible to this equation?

Given $$A+2B+3C=N$$ where $N$ is a given positive integer.

$A ,B,C\in\mathbb{N}$ vary from $0$ to $\infty$.

How many solutions will be there to this equation?

-
Please try and format your questions using $\LaTeX$ notation, and avoid non-standard abbreviations. – Andreas Caranti Mar 19 '13 at 16:51
$N+3-1\choose{3-1}$ , it isn't possible I suppose? – Inceptio Mar 19 '13 at 17:00
Are $A,B,C$ also integers? – Berci Mar 19 '13 at 17:00
Yes A,B,C are intergers – user1907531 Mar 19 '13 at 17:01
@Berci ,ABC are integrs – user1907531 Mar 19 '13 at 17:04

It appears to be sequence A001399 at the Online Encyclopedia of Integer Sequences, where the simple formula $${\rm round}{(n+3)^2\over12}$$ is given, along with lots of interpretations, links, references, and so on.

-

Let $X=C, Y=B+C, Z=A+B+C$, then this is equivalent to finding the number of non-negative integer solutions to $X+Y+Z=N$ s.t. $X \leq Y \leq Z$.

First ignore the restriction on $X, Y, Z$. In total we have $\binom{N+2}{2}$ solutions.

The number of solutions with $Y=Z$ is just the number of non-negative integer solutions to $2Y \leq N$, giving $\lfloor \frac{N}{2} \rfloor+1$. By symmetry we get the same number of solutions for $X=Y, X=Z$.

The number of solutions for $X=Y=Z$ is 1 if $3 \mid N$ and 0 otherwise. We can represent this as $1-\lceil \frac{N}{3}-\lfloor \frac{N}{3} \rfloor \rceil$.

The number of solutions with exactly 2 variables equal is thus $3[(\lfloor \frac{N}{2} \rfloor+1)-(1-\lceil \frac{N}{3}-\lfloor \frac{N}{3} \rfloor \rceil)]$.

Now going back to the problem, each solution where $X<Y<Z$ corresponds to 6 solutions where $X, Y, Z$ are distinct. Each solution with $X \leq Y \leq Z$ and exactly 2 of them equal corresponds to 3 solutions where exactly 2 of them equal but without the condition $X \leq Y \leq Z$.

We thus get:

\begin{align} & \frac{\binom{N+2}{2}-3(\lfloor \frac{N}{2} \rfloor+1)+2(1-\lceil \frac{N}{3}-\lfloor \frac{N}{3} \rfloor \rceil)}{6} \\ & +\frac{3(\lfloor \frac{N}{2} \rfloor+1)-3(1-\lceil \frac{N}{3}-\lfloor \frac{N}{3} \rfloor \rceil)}{3} +(1-\lceil \frac{N}{3}-\lfloor \frac{N}{3} \rfloor \rceil) \\ & =\frac{\binom{N+2}{2}+3(\lfloor \frac{N}{2} \rfloor+1)+2(1-\lceil \frac{N}{3}-\lfloor \frac{N}{3} \rfloor \rceil)}{6} \end{align}

-
This is what I was tryna do(Use greatest int func).:). +1 Great solution. – Inceptio Mar 20 '13 at 5:10

The result will be equal to the coeeficient of $x^{n}$ in $(x+x^{2}+x^{3}+\dots)(x^{2}+x^{4}+\dots)(x^{3}+x^{6}+\dots)$

-