I'm trying to find a function $g$ that satisfies $$g\big(x,\ 2y(1-y)\big)=2g(x,\ y)\big(1-g(x,\ y)\big)$$ for all $x,y∈\mathbb{Z}$ and whose output also lies in $\mathbb{Z}$. Another requirement is symmetry: $g(x,y)=g(y,x)$, and associativity is highly desirable too: $g(x,g(y,z))=g(g(x,y),z)$.
One obvoius fact is that it the equation instanlty defines the value of $g$ at a non-integer point $(x,1/2)$, namely plugging into the equation and rearranging gives $g(x,1/2)=1/2$ for all $x$, but apart from that, I'm stuck.
A slightly broader version of the problem actually involves two integer-valued functions, $g_1$ and $g_2$, the equations defining them being
$$g_1(x_1,\ a_1b_1) = g_1(x_1,\ a_1)g(x_2,\ a_2)$$
for which I figured a solution
$$g_1(x_1,y_1)=\prod\limits_{p∈\mathbb{P}}p^{v_p(x_1)v_p(y_1)}$$
where the product is taken over the set of prime numbers and $v_p(x)$ is the $p$-valuation of x, i.e. the power of $p$ in the factorization of $x$. It is commutative and assocaitive and distributes over multiplication, which is kinda the whole point of the equation. (by the way, does this function, $g_1$, have a common name? it looks quite general and number-theoretic)
For $g_2$, the equation is the following:
$$g_2(x_1,\ x_2,\ a_1b_1,\ a_1^2b_2+a_2b_1^2-2a_2b_2)=g_1(x_1,\ a_1)^2g_2(x_1,\ x_2,\ b_1,\ b_2)+g_2(x_1,\ x_2,\ a_1,\ a_2)g_1(x_1,\ b_1)^2-2g_2(x_1,\ x_2,\ a_1,\ a_2)g_2(x_1,\ x_2,\ b_1,\ b_2)$$
For which plugging $y_1=a_1=b_1,\ y_2=a_2=b_2$ for simplification and replacing $g_1$'s with the prime number thing yields
$$g_2\big(x_1,\ x_2,\ y_1^2,\ 2y_2(y_1^2-y_2)\big)=2g_2(x_1,\ x_2,\ y_1,\ y_2)\bigg(\prod\limits_{p∈\mathbb{P}}p^{v_p(x_1)v_p(y_1)} - g_2(x_1,\ x_2,\ y_1,\ y_2)\bigg)$$
The problem I described in the beginning is this second equation under the requirement $x_1=y_1=1$ which I have had some vague reasons to impose.
So, any suggestions on how to solve any of this, or at least make a few more steps towards the solution, would be extremely helpful!