How can this equation be simplified to give $y$?: $x = \frac{(-1)^y ( 5 (-1)^y y - y + (-1)^y - 1))}4$ I'm trying to convert this equation to the form $y = ...$, but I am stuck. It seems the $y$-root of $(-1)^y$ is not $-1$, but is instead a beast. Here is the overall equation:
$$x = \frac{(-1)^y  ( 5  (-1)^y  y - y + (-1)^y - 1))}4$$
Note: y is an integer, x is an integer.
I could be open to x needing to be a complex number as long as there are solutions where x ∈ { 3+0i, 5+0i, 7+0i, ...} and y ∈ { 5, 8, 11, ...}.
Note: the point is to avoid using separate equations for even vs. odd, but to have one equation that handles both. That's why the first equation has (-1)^n in it; it makes the equation = y when y is even, and (3y+1)/2 when y is odd. However that trick is not as helpful when we only care about every third number instead of every second number.
Context: I'm an old man trying to refresh my math skills by learning about groups and branch groups. I'm not sure how much extra context you want. Trying to build a map between 2n+1 and 3n+2, kind of.

You can make a case decision. Let $y$ be an even integer  then
$$x= \frac{1\cdot   ( 5 \cdot  1\cdot  y - y + 1 - 1))}4=\frac{  4y }4=y$$.
Let $y$ be an odd integer  then
$$x=\frac{-( -5   y - y -1 - 1))}4=\frac{-(-6y-2)}{4}=\frac{6y+2}{4}$$
Solving for y gives $y=\frac{4x-2}{6}=\frac23x-\frac13$. So the function is
$$y=\begin{cases} x, \quad\ \ \ \ \ \ \textrm{if y is an even integer}  \\ \frac23x-\frac13, \textrm{if y is an odd integer}\end{cases}$$
So you calculate both cases, and then you make the decision which one case is right. IMHO it is the easiest approach. I don't see a handy way for non-integers.
