A pattern appearing in a dynamical sequence of polynomials This question came up while I was looking at the dynamics of the map in this question
Let $f : \Bbb C[x,y,z] \to \Bbb C[x,y,z]$ given by $f(P)(x,y,z) = P(y(x+y),2z^2,z(x+y))$.
Consider the sequence of polynomials obtained by iterating $f$ on $z$ :
 $P_0(x,y,z) = z$ and $P_{n+1} = f(P_n)$ for $n \ge 0$.
The first  terms are $P_1 = z(x+y), P_2 = z(x+y)(y(x+y)+2z^2),$
$P_3 = 2z^3(x+y)(y(x+y)+2z^2)(x^2+3xy+2y^2+2z^2)$
Let $a_n$ be the numbers of $z$ factors in the prime factorisation of $P_n$.
Starting from $a_0$, the sequence is $1,1,1,3,5,9,19,37,73,\ldots$
let $A(t)$ be the power series $\sum_{n \ge 0} a_n t^n$.
Is it true that $A(t) = \frac {1-t-t^2}{(1-t^3)(1-2t)}$ ?

$f$ has a some kind of pseudo-inverse (after all it comes from an automorphism of $\Bbb P^2(\Bbb C)$).
Define $g$ by $g(P)(x,y,z) = P(2z^2-xy,xy,yz)$.  
Then $g(f(P))(x,y,z) = f(P)(2z^2-xy,xy,yz) = P(2xyz^2,2y^2z^2,2yz^3)$.
And so if $P$ is homogeneous of degree $d$ then $g(f(P)) = (2yz^2)^d P$
Something similar happens for $f \circ g$, with a factor of $(2(x+y)z^2)^d$.
This should show that if $P$ is homogeneous and irreducible, then $f(P)$ (and $g(P)$) is the product of some irreducible polynomial with some extra small factors $(x+y)$ or $z$ ($y$ and $z$ in the case of $g$).  
Then it is computationally easier to only keep that irreducible factor.
Define sequences $Q_n$ and $b_n$ with $Q_0 = z$ and $z^{b_{n+1}}Q_{n+1} = f(Q_n)$ 
(it does seem like, in this case, no new $(x+y)$ factor appears except in $Q_1$ so I am focusing only on $z$. A proof of this fact would also be welcome)
Then if we let $B(t) = \sum_{n \ge 1} b_nt^n$, $A$ and $B$ are related by the equation $A(t)B(t) = A(t)-1$, and so my question has the equivalent form :
Is it true that $B(t) = \frac{A(t)-1}{A(t)} = \frac{t-t^2+t^3-2t^4}{1-t-t^2}$ ?
 A: The results for this problem are typical. Define the  homogeneous quadratic polynomial:
$\;L(x,y,z)=(y(x+y),2z^2,z(x+y)),\,$ and using initial value $L_0(x,y,z) = (x,y,z),\,$ define sequence $\,L_n\,$ by recursion $\,L_{n+1}=L(L_n).$
Now name the three components: $\;(r_n,q_n,p_n):=L_n(x,y,z).\;$ For example, $\,r_2=2z^2(xy+y^2+2z^2),\,q_2=2(x+y)^2z^2,\,p_2=(x+y)(xy+y^2+2z^2)z.$
Note that
$\;p_n = 2 p_{n-1}(p_{n-2}^3 + p_{n-1}p_{n-3}^2)/p_{n-2}\;$ for $n\ge 3,\;$ and $ r_{n+1}=(r_n+q_n)q_n,\;q_{n+1}=2 p_n^2.$
Define a sequence of irreducible factors of the $\,p\,$ polynomials: $\;f_0:=z,\;f_1:=x+y,\;f_2:=xy+y^2+2z^2,\;$ and then
$\;f_n := (U_n2^{u_n} f_{n-1} g_{n-4}^2 + V_n2^{v_n} g_{n-2}^2)/2^{w_n},\;$ with
$\;g_{-1}:=1,\;g_0:=f_0,\;g_1:=f_1,\;g_2:=f_2,\;$ $g_n:=f_n g_{n-3}\;$ if $n>2,\;$
with $\;U_2:=y,\;V_2:=4,\;U_3:=U_4=V_3=2,\;V_4:=1,\;U_n:=V_n=1,\;$ if $n>4,\;$
and $\;u_n\!:=\!(n-4)2/3\;$ if $\;n\equiv1{\pmod 3},$ else $0$,
$\;v_n\!:=\!1+(n-5)2/3\;$ if $\;n\equiv2{\pmod 3},$ else $0$,
$\;w_n\!:=\!1\;$ if $\;n\equiv0{\pmod 3},$ else $0$.
We have $\;p_n= 2^{c_n} \prod_{k=0}^n f_{n-k}^{a_k},\;$ for $\;n\ge0\;$ where $\;a_n,c_n\;$ are non-negative integer sequences. The generating function (g.f.) for $\;a_n\;$ is $\;A(t) = (1-t-t^2)/((1-t^3)(1-2t)),\;$ while the g.f. for $\;c_n\;$
is $\;t^3(1-t^4-t^5)/((1-t^3)^2(1-2t)).\;$
