How do you simplify an equation for only integer inputs?

86 Views Asked by At

I've been trying to simplify an equation for the last few weeks. Below is the initial equation:

$y(n) = -\frac{3+2n}{8}(-1)^{\frac{2n+1-(-1)^n}{4}}+\frac{1}{8}(-1)^{\frac{6n+1-(-1)^n}{4}}+\frac{1}{4}(-1)^{\frac{2n+1-(-1)^n}{2}}$

This equation outputs a result of 0,0,1,1,-1,-1,2,2,-2,-2,3,3,... for integer inputs.

While this equation works fine, it is quite ugly. I have tried simplifying it a few different ways, but ultimately the best form I was able to get is shown below:

$y(n) = \frac{i^n}{8}[(1+n)(1+e^{i\pi n}) +i(2+n)(1-e^{i \pi n})]+\frac{1}{4}$

While this function has different complex components than the original, this does not matter to me. I am interested in preserving the output for given inputs, and do not care what happens to the equation on non-integer inputs.

Does anyone have any clever ideas of how to simplify my equation further while preserving the output for integer inputs?

For those interested, if y(n) is plotted against y(n+1), it forms a square spiral.

Do you know of any similar problems where you simplify an equation based on only certain inputs?

1

There are 1 best solutions below

0
On BEST ANSWER

The OEIS sequence A242601 "Integers repeated twice in a canonical order" is what you have. The formula given there using the floor function is $\, a_n = \lfloor{(n+2)/4}\rfloor (-1)^{\lfloor{(n+2)/2}\rfloor}.\,$