$x_i=x_{i-1}^2+a\pmod{N}$, $N$ is an odd composite number, assume $N=p \cdot q$ with $p,q$ primes, $x_0=1$ then calculate $\gcd(x_i,N)$, for what $a$ the quadratic iterative function give one factor of $N$.
$N=4181=37 \cdot 113$, $a=4,7,2357$. The essential condition that $\gcd(x_i,N)\neq1$ maybe $a$ is a quadratic residue of $N$.
This is related to the Pollard rho method of factorization, as noted in the comments. Typically, the iteration generates only $C\sqrt p$ different residues modulo $p$ for some (fixed) constant $C$, so for any particular $a$ it's unlikely there will be an index $i$ with $\gcd(x_i,N)=p$.
To get $\gcd(x_i,N)=p$, $-a$ has to be a quadratic residue modulo $p$ (a necessary condition, but I don't expect it to be a sufficient condition).