In Table of Integrals, Series and Products (p. 869) by Gradshteyn and Ryzhik, I found the identity (called 'the Weierstrass expansion of $\operatorname{sn}$') $$\operatorname{sn}u=\frac{B}{A}$$ where $\operatorname{sn}$ is the Jacobi elliptic function $\operatorname{sn}$, $$B=\sum_{n=0}^\infty (-1)^n b_n\frac{u^{2n+1}}{(2n+1)!},$$ $$A=1-\sum_{n=1}^\infty (-1)^{n+1}a_{n+1}\frac{u^{2n+2}}{(2n+2)!},$$ $$b_0=1,\, b_1=1+k^2,\, b_2=1+k^4+4k^2,\,\ldots ,$$ and $$a_2=2k^2,\, a_3=8(k^2+k^4),\ldots ,$$ ($k$ is the elliptic modulus). Note that Gradshteyn and Ryzhik write only the first few terms and don't write the general term.
My question
I know the Weierstrass factorization theorem. But it is unclear to me how the sequences $\{a_n\}_n$ and $\{b_n\}_n$ are generated. How can one come up with them? What is the "general term" of the sequences?
This question has also been posted on MSE: https://math.stackexchange.com/questions/4683898/where-does-the-weierstrass-expansion-of-operatornamesn-come-from