# Unifying polynomials

Solving a combinatorial problem I find that there are $p(n)=\frac{1}{24}(5n^3+3n^2-2n)$ solutions for even $n$ and $q(n)=\frac1{24}(5n^3+3n^2-5n-3)$ for odd $n$. Now I would like to find a "uninomial" that coincides with $p$ for all even values and with $q$ for all odd values.

A trivial example would be $p(n)+(\lceil\frac n2\rceil-\lfloor\frac n2\rfloor)(q(n)-p(n))$, but I want something more specific.

I want (in this case) an expression of the form $a_3p_3^3+a_2p_2^2+a_1p_1+a_0$, where each $p_i$ is either $n$ or $\lceil\frac n2\rceil$ or $\lfloor\frac n2\rfloor$ (and each $a_i$ is a real number).

Or, slightly more general, every $p_i^i$ may be replaced by a product of $i$ factors, each of which is either $n$ or $\lceil\frac n2\rceil$ or $\lfloor\frac n2\rfloor$.

The specific problem is small enough to succumb to a brute force attack by a computer program, but I am looking for a kind of mechanism.

Any ideas? Or a reference maybe? Stupid Google has never heard of a uninomial and I seem unable to find the keywords that may trap Google into revealing a relevant location.

$$p(n)=\frac1{24}(5n^3+3n^2-2n) \text { n even}$$
$$q(n)=\frac1{24}(5n^3+3n^2-2n-3(n+1)) \text { n odd}$$
Because $(1-(-1)^n)/2=0$ if $n$ even and $(1-(-1)^n)/2=1$ if $n$ odd, we can combine $p(n)$ and $q(n)$ as: $$f(n)=\frac1{24}\left(5n^3+3n^2-2n-\frac{3}{2}(n+1)(1-(-1)^n)\right)$$
• Thanks Mike, but this is an answer in the category "$p(n)+(⌈n2 ⌉−⌊n2 ⌋)(q(n)−p(n))$" and not what I am looking for. It does not satisfy the requirements (e.g. an exponent $n$ is not allowed). Also I do not really need an answer to the example problem, but a way to attack this kind of problem in general. Jun 18, 2014 at 10:11